Verified Commit feadc2cb authored by Markus Koller's avatar Markus Koller 🦊
Browse files

Fix bugs with billing expenses

parent b1c30c51
Pipeline #17329 failed with stage
in 56 minutes and 22 seconds
......@@ -47,7 +47,7 @@ class BillingExpensesController < ApplicationController
def destroy
@billing_expense.destroy
redirect_to @volunteer, make_notice
redirect_to billing_expenses_url, make_notice
end
private
......
......@@ -9,6 +9,8 @@ module FormatHelper
end
def format_hours_period(hours)
return '' if hours.blank?
dates = hours.map(&:meeting_date)
"#{I18n.l dates.min} - #{I18n.l dates.max}"
end
......
......@@ -14,7 +14,7 @@ class BillingExpense < ApplicationRecord
AMOUNT = [50, 100, 150].freeze
validates :iban, presence: true
validates :volunteer, :user, :iban, presence: true
validates :amount, inclusion: { in: AMOUNT }, unless: :import_mode
def self.amount_for(hours)
......
......@@ -102,4 +102,19 @@ class BillingExpensesTest < ApplicationSystemTestCase
assert_text "Erstellt am Zürich, #{I18n.l @billing_expense1.created_at.to_date, format: :long}"
assert_text "Erstellt von #{@superadmin}"
end
test 'delete billing expenses' do
@billing_expense4.destroy
visit billing_expenses_path
assert_text @billing_expense1.volunteer
page.accept_confirm do
click_link 'Löschen'
end
assert_text 'Spesenformular wurde erfolgreich gelöscht.'
refute_text @billing_expense1.volunteer
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment