Browse Source

Display correct assigned to user in CSV filters (#2433)

pull/2436/head
kosiakkatrina 8 months ago committed by GitHub
parent
commit
3a5b210da5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/helpers/filters_helper.rb
  2. 8
      spec/requests/lettings_logs_controller_spec.rb

2
app/helpers/filters_helper.rb

@ -251,7 +251,7 @@ private
return "All" if session_filters["assigned_to"].include?("all")
return "You" if session_filters["assigned_to"].include?("you")
user = User.find(session_filters["user"].first)
user = User.find(session_filters["user"])
"#{user.name} (#{user.email})"
end

8
spec/requests/lettings_logs_controller_spec.rb

@ -1433,6 +1433,14 @@ RSpec.describe LettingsLogsController, type: :request do
expect(page).to have_link("Change", href: "/lettings-logs/filters/status?codes_only=false&referrer=check_answers&search=#{search_term}")
expect(page).to have_link("Change", href: "/lettings-logs/filters/needstype?codes_only=false&referrer=check_answers&search=#{search_term}")
end
it "displays correct assigned to filter" do
create_list(:user, 12, organisation: user.organisation)
filtered_user = create(:user, organisation: user.organisation, name: "Obviously not usual name")
get("/lettings-logs/csv-download?years[]=#{lettings_log.form.start_date.year}&search=#{search_term}&codes_only=false&assigned_to=specific_user&user=#{filtered_user.id}", headers:)
expect(page).to have_content("Obviously not usual name")
end
end
context "when there are no years selected in the filters" do

Loading…
Cancel
Save