From 4963cefccc58c667ff59c09a11262798f46cb9bb Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Mon, 11 Sep 2023 14:36:52 +0100 Subject: [PATCH] [Brent] Include location_name field in CSV export For FD-3335 --- perllib/FixMyStreet/Cobrand/Brent.pm | 2 ++ t/cobrand/brent.t | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/perllib/FixMyStreet/Cobrand/Brent.pm b/perllib/FixMyStreet/Cobrand/Brent.pm index 1e784dac6f4..0f3941008a9 100644 --- a/perllib/FixMyStreet/Cobrand/Brent.pm +++ b/perllib/FixMyStreet/Cobrand/Brent.pm @@ -219,6 +219,7 @@ sub dashboard_export_problems_add_columns { $csv->add_csv_columns( street_name => 'Street Name', + location_name => 'Location Name', created_by => 'Created By', email => 'Email', usrn => 'USRN', @@ -260,6 +261,7 @@ sub dashboard_export_problems_add_columns { return { street_name => $report->nearest_address_parts->{street}, + location_name => $report->get_extra_field_value('location_name') || '', created_by => $report->name || '', email => $report->user->email || '', usrn => $report->get_extra_field_value('usrn') || '', diff --git a/t/cobrand/brent.t b/t/cobrand/brent.t index 2cdc42c4079..495a442fab1 100644 --- a/t/cobrand/brent.t +++ b/t/cobrand/brent.t @@ -1095,6 +1095,12 @@ subtest 'Dashboard CSV extra columns' => sub { $flexible_problem->update; $mech->get_ok('/dashboard?export=1'); ok $mech->content_like(qr/Flexible problem.*?,121,Y,Yes,No,"Small van load",Appliance,/, "Flytip request values added"); + $flexible_problem->set_extra_fields( + {name => 'location_name', value => 'Test Park'}, + ); + $flexible_problem->update; + $mech->get_ok('/dashboard?export=1'); + ok $mech->content_like(qr/Flexible problem.*?,,,"Test Park","Test User",.*?,,,121,Y,,,,,,,,/, "Location name added") or diag $mech->content; } };