Verified Commit 0cf94295 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

prevent semester passed from index link to new action does not contain any hours

parent aba7a3cf
......@@ -55,8 +55,6 @@ class BillingExpensesController < ApplicationController
authorize @billing_expense
@selected_billing_semester = selected_billing_semester
set_default_filter(semester: @selected_billing_semester)
@q = Volunteer.with_billable_hours(@selected_billing_semester).ransack(params[:q])
@volunteers = @q.result
@selected_volunteers = params[:selected_volunteers].presence || []
......@@ -108,9 +106,13 @@ class BillingExpensesController < ApplicationController
def selected_billing_semester
if params[:q].blank?
set_default_filter(semester: default_billing_semester)
default_billing_semester
elsif params[:q][:all].present?
nil
elsif !@billing_semester_filters.pluck(:value).include? params[:q][:semester]
params.permit![:q][:semester] = default_billing_semester
default_billing_semester
else
params[:q][:semester]
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