From 86d8b420adef71fc1ad0bbbd8e2ddd184e79dfcc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 16 Sep 2024 09:54:20 +0100 Subject: [PATCH] Fix questionnaire time check in CSV export. Make sure returned in date order, and check correct value. --- perllib/FixMyStreet/Script/CSVExport.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perllib/FixMyStreet/Script/CSVExport.pm b/perllib/FixMyStreet/Script/CSVExport.pm index 3a8c06fa93..d6e6b0a059 100644 --- a/perllib/FixMyStreet/Script/CSVExport.pm +++ b/perllib/FixMyStreet/Script/CSVExport.pm @@ -244,7 +244,7 @@ EOF DECLARE csr CURSOR WITH HOLD FOR $sql_with SELECT $sql_select FROM "problem" "me" $sql_join WHERE regexp_split_to_array("me"."bodies_str", ',') && ARRAY['$body_id'] $where_states -ORDER BY "me"."confirmed", "me"."id", "comments"."confirmed", "comments"."id"; +ORDER BY "me"."confirmed", "me"."id", "comments"."confirmed", "comments"."id", "questionnaire"."whenanswered", "questionnaire"."id"; EOF } @@ -331,7 +331,7 @@ sub process_questionnaire { my ($hashref, $obj) = @_; my $new_state = $obj->{questionnaire_new_state} || ''; if ($fixed_states->{$new_state}) { - if (!$hashref->{fixed} || $obj->{comment_confirmed} lt $hashref->{fixed}) { + if (!$hashref->{fixed} || $obj->{questionnaire_whenanswered} lt $hashref->{fixed}) { $hashref->{fixed} = $obj->{questionnaire_whenanswered}; } }