fix: export daily change dates transposition

reference #148
This commit is contained in:
hackerESQ
2025-11-04 19:59:33 -06:00
parent bb0a0ef928
commit 5f583de857
3 changed files with 20 additions and 3 deletions
+18 -1
View File
@@ -33,7 +33,24 @@ class DailyChangesSheet implements FromCollection, WithHeadings, WithTitle
*/
public function collection()
{
return $this->empty ? collect() : DailyChange::myDailyChanges()->withDailyPerformance()->get();
if ($this->empty) {
return collect();
}
return DailyChange::myDailyChanges()
->withDailyPerformance()
->get()
->map(function ($daily_change) {
return [
'date' => date_format($daily_change->date, 'Y-m-d'),
'portfolio_id' => $daily_change->portfolio_id,
'total_market_value' => $daily_change->total_market_value,
'total_cost_basis' => $daily_change->total_cost_basis,
'realized_gains' => $daily_change->realized_gain_dollars,
'total_dividends_earned' => $daily_change->total_dividends_earned,
'annotation' => $daily_change->annotation,
];
});
}
public function title(): string
+1 -1
View File
@@ -58,7 +58,7 @@ class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
'currency' => $transaction->market_data_currency,
'split' => $transaction->split,
'reinvested_dividend' => $transaction->reinvested_dividend,
'date' => $transaction->date,
'date' => date_format($transaction->date, 'Y-m-d'),
'created_at' => $transaction->created_at,
'updated_at' => $transaction->updated_at,
];