Skip to content

Commit

Permalink
fix: bug on saving config, fixes #801
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbauer authored and yksflip committed Feb 15, 2024
1 parent d61b87a commit 8b152bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/controllers/admin/configs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def parse_recurring_selects!(config)
for k in %i[pickup boxfill ends] do
if config[k]
# allow clearing it using dummy value '{}' ('' would break recurring_select)
if config[k][:recurr].present? && config[k][:recurr] != '{}'
if config[k][:recurr].present? && config[k][:recurr] != '{}' && !config[k][:recurr].nil?
config[k][:recurr] = ActiveSupport::JSON.decode(config[k][:recurr])
config[k][:recurr] = FoodsoftDateUtil.rule_from(config[k][:recurr]).to_ical if config[k][:recurr]
date = FoodsoftDateUtil.rule_from(config[k][:recurr])
config[k][:recurr] = date.to_ical if date
else
config[k] = nil
config[k][:recurr] = ''
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/lib/foodsoft_date_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def self.rule_from(rule)
IceCube::Rule.from_ical(rule)
when Hash
IceCube::Rule.from_hash(rule)
when ActionController::Parameters
IceCube::Rule.from_hash(rule.to_hash)
else
rule
end
Expand Down

0 comments on commit 8b152bf

Please sign in to comment.