Skip to content

Commit

Permalink
Sync account after balance deletion
Browse files Browse the repository at this point in the history
- Fixes #1416
- Fixes timezone bugs in forms
  • Loading branch information
zachgoll committed Nov 6, 2024
1 parent 455257b commit 2722254
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/controllers/transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def create

def bulk_delete
destroyed = Current.family.entries.destroy_by(id: bulk_delete_params[:entry_ids])
destroyed.map(&:account).uniq.each(&:sync_later)
redirect_back_or_to transactions_url, notice: t(".success", count: destroyed.count)
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/account/trades/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
</div>

<%= form.date_field :date, label: true, value: Date.current %>
<%= form.date_field :date, label: true, value: Date.today %>

<div data-trade-form-target="amountInput" hidden>
<%= form.money_field :amount, label: t(".amount"), disable_currency: true %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/account/valuations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class: "space-y-4",
data: { turbo: false } do |form| %>
<div class="space-y-3">
<%= form.date_field :date, label: true, required: true, value: Date.current, min: Account::Entry.min_supported_date, max: Date.current %>
<%= form.date_field :date, label: true, required: true, value: Date.today, min: Account::Entry.min_supported_date, max: Date.today %>
<%= form.money_field :amount, label: t(".amount"), required: true, default_currency: Current.family.currency %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/transactions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<%= f.fields_for :entryable do |ef| %>
<%= ef.collection_select :category_id, Current.family.categories.alphabetically, :id, :name, { prompt: t(".category_prompt"), label: t(".category") } %>
<% end %>
<%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.current, value: Date.current %>
<%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.today, value: Date.today %>
</section>

<section>
Expand Down

0 comments on commit 2722254

Please sign in to comment.