mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
Recurring fixes (#454)
* Fix record violation and add toggle for recurring feature * Run only once per sync cycle ( 30 sec ) * FIX params passing * Add collapsible to recurring section * FIX preferences error catch
This commit is contained in:
@@ -234,6 +234,29 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# Transactions preferences management
|
||||
def transactions_section_collapsed?(section_key)
|
||||
preferences&.dig("transactions_collapsed_sections", section_key) == true
|
||||
end
|
||||
|
||||
def update_transactions_preferences(prefs)
|
||||
transaction do
|
||||
lock!
|
||||
|
||||
updated_prefs = (preferences || {}).deep_dup
|
||||
prefs.each do |key, value|
|
||||
if value.is_a?(Hash)
|
||||
updated_prefs["transactions_#{key}"] ||= {}
|
||||
updated_prefs["transactions_#{key}"] = updated_prefs["transactions_#{key}"].merge(value)
|
||||
else
|
||||
updated_prefs["transactions_#{key}"] = value
|
||||
end
|
||||
end
|
||||
|
||||
update!(preferences: updated_prefs)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def default_dashboard_section_order
|
||||
%w[cashflow_sankey outflows_donut net_worth_chart balance_sheet]
|
||||
|
||||
Reference in New Issue
Block a user