mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	This commit is contained in:
		| @@ -472,6 +472,7 @@ class AccountController extends Controller | ||||
|      */ | ||||
|     private function periodByCurrency(Carbon $start, Carbon $end, Account $account, TransactionCurrency $currency): array | ||||
|     { | ||||
|         app('log')->debug(sprintf('Now in periodByCurrency("%s", "%s", %s, "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'), $account->id, $currency->code)); | ||||
|         $locale  = app('steam')->getLocale(); | ||||
|         $step    = $this->calculateStep($start, $end); | ||||
|         $result  = [ | ||||
| @@ -481,6 +482,13 @@ class AccountController extends Controller | ||||
|         ]; | ||||
|         $entries = []; | ||||
|         $current = clone $start; | ||||
|         app('log')->debug(sprintf('Step is %s', $step)); | ||||
| 
 | ||||
|         // fix for issue https://github.com/firefly-iii/firefly-iii/issues/8041
 | ||||
|         // have to make sure this chart is always based on the balance at the END of the period.
 | ||||
|         // This period depends on the size of the chart
 | ||||
|         $current = app('navigation')->endOfX($current, $step, null); | ||||
|         app('log')->debug(sprintf('$current date is %s', $current->format('Y-m-d'))); | ||||
|         if ('1D' === $step) { | ||||
|             // per day the entire period, balance for every day.
 | ||||
|             $format   = (string)trans('config.month_and_day_js', [], $locale); | ||||
| @@ -497,10 +505,13 @@ class AccountController extends Controller | ||||
|         } | ||||
|         if ('1W' === $step || '1M' === $step || '1Y' === $step) { | ||||
|             while ($end >= $current) { | ||||
|                 app('log')->debug(sprintf('Current is: %s', $current->format('Y-m-d'))); | ||||
|                 $balance         = (float)app('steam')->balance($account, $current, $currency); | ||||
|                 $label           = app('navigation')->periodShow($current, $step); | ||||
|                 $entries[$label] = $balance; | ||||
|                 $current         = app('navigation')->addPeriod($current, $step, 0); | ||||
|                 // here too, to fix #8041, the data is corrected to the end of the period.
 | ||||
|                 $current = app('navigation')->endOfX($current, $step, null); | ||||
|             } | ||||
|         } | ||||
|         $result['entries'] = $entries; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user