mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 04:24:06 +00:00
Fix struct compatibility error in IncomeStatement::Totals (#603)
The TotalsRow struct was expanded from 5 to 6 fields in commit a4f70f4
(adding is_uncategorized_investment), but cached data from the old
5-field struct causes "struct size differs" errors when deserialized.
This adds a cache version ("v2") to the totals_query cache key to
invalidate all old cached structs and force recalculation with the
new 6-field definition.
Fixes: TypeError (struct IncomeStatement::Totals::TotalsRow not compatible (struct size differs))
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -130,7 +130,7 @@ class IncomeStatement
|
|||||||
sql_hash = Digest::MD5.hexdigest(transactions_scope.to_sql)
|
sql_hash = Digest::MD5.hexdigest(transactions_scope.to_sql)
|
||||||
|
|
||||||
Rails.cache.fetch([
|
Rails.cache.fetch([
|
||||||
"income_statement", "totals_query", family.id, sql_hash, family.entries_cache_version
|
"income_statement", "totals_query", "v2", family.id, sql_hash, family.entries_cache_version
|
||||||
]) { Totals.new(family, transactions_scope: transactions_scope, date_range: date_range).call }
|
]) { Totals.new(family, transactions_scope: transactions_scope, date_range: date_range).call }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user