fix: daily change should be synced when before latest transaction

This commit is contained in:
hackerESQ
2025-04-11 21:14:53 -05:00
parent 38a65f99c9
commit 71e79cfb40
+1 -1
View File
@@ -21,7 +21,7 @@ class EnsureDailyChangeIsSynced
! Cache::has($cacheKey)
&& $model->date->lessThan(now())
&& ($model->date->lessThan($model->portfolio->daily_change()->min('date') ?? now())
|| $model->date->lessThan($model->portfolio->transactions()->where('id', '!=', $model->id)->min('date') ?? now())
|| $model->date->lessThan($model->portfolio->transactions()->where('id', '!=', $model->id)->max('date') ?? now())
)
) {
defer(fn () => $model->portfolio->syncDailyChanges());