diff options
author | Dave Arter <davea@mysociety.org> | 2020-01-09 10:29:36 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2020-01-09 11:52:36 +0000 |
commit | 4257ab747215db1b5e3eced9ce182706dbba445c (patch) | |
tree | a89c92329e1d997781edb762d7c85b9fb8988595 | |
parent | c4961f186e1bf5b9f14fa51e99c37bc013dd8e37 (diff) |
[Zürich] Fix ambiguous query param when exporting admin stats CSV by month
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 2 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 1040116ed..bedbe2d94 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -1153,7 +1153,7 @@ sub admin_stats { if ($y && $m) { $c->stash->{start_date} = DateTime->new( year => $y, month => $m, day => 1 ); $c->stash->{end_date} = $c->stash->{start_date} + DateTime::Duration->new( months => 1 ); - $optional_params{created} = { + $optional_params{'me.created'} = { '>=', DateTime::Format::Pg->format_datetime($c->stash->{start_date}), '<', DateTime::Format::Pg->format_datetime($c->stash->{end_date}), }; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index b82d50b68..f2dd754f1 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -81,7 +81,8 @@ my $external_body2 = $mech->create_body_ok( 4, 'Another Body External', sub get_export_rows_count { my $mech = shift; - $mech->get_ok( '/admin/stats?export=1' ); + my $extra = shift || ''; + $mech->get_ok( '/admin/stats?export=1' . $extra); is $mech->res->code, 200, 'csv retrieved ok'; is $mech->content_type, 'text/csv', 'content_type correct' and do { my @lines = split /\n/, $mech->content; @@ -871,6 +872,8 @@ subtest "test stats" => sub { is $export_count - $EXISTING_REPORT_COUNT, 3, 'Correct number of reports'; $mech->content_contains('fixed - council'); } + $export_count = get_export_rows_count($mech, '&ym=' . DateTime->now->strftime("%m.%Y")); + is $export_count - $EXISTING_REPORT_COUNT, 3, 'Correct number of reports when filtering by month'; }; subtest "test admin_log" => sub { |