Skip to content

Commit

Permalink
Do not skip mark_fixed updates in CSV export.
Browse files Browse the repository at this point in the history
Without this, the fixed timestamp wasn't being set on questionnaire
updates (which have mark_fixed and no problem_state).
  • Loading branch information
dracos committed Aug 16, 2024
1 parent 3d28fce commit b68f825
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Fix restoring a draft with no location.
- Create reporter alert before creating first unconfirmed auto-update.
- Fix display of user in assignment dropdown. #4855
- Fix setting of fixed timestamp in CSV export. #5119
- Admin improvements:
- Rename emergency message to site message.
- Added a category control for overriding the text of the new report details field.
Expand Down
3 changes: 2 additions & 1 deletion perllib/FixMyStreet/Reporting.pm
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ sub generate_csv {
my @updates = $obj->comments->all;
@updates = sort { $a->confirmed <=> $b->confirmed || $a->id <=> $b->id } @updates;
for my $comment (@updates) {
my $problem_state = $comment->problem_state or next;
next unless $comment->problem_state || $comment->mark_fixed;
my $problem_state = $comment->problem_state || '';
next if $problem_state eq 'confirmed';
$hashref->{acknowledged} //= $comment->confirmed;
$hashref->{action_scheduled} //= $problem_state eq 'action scheduled' ? $comment->confirmed : undef;
Expand Down
3 changes: 2 additions & 1 deletion perllib/FixMyStreet/Script/CSVExport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ row timestamps.
sub process_comment {
my ($hashref, $obj) = @_;
return if $hashref->{closed}; # Once closed is set, ignore further more comments
my $problem_state = $obj->{problem_state} or return;
return unless $obj->{problem_state} || $obj->{mark_fixed};
my $problem_state = $obj->{problem_state} || '';
return if $problem_state eq 'confirmed';
$hashref->{acknowledged} //= $obj->{comment_confirmed};
$hashref->{action_scheduled} //= $problem_state eq 'action scheduled' ? $obj->{comment_confirmed} : undef;
Expand Down
1 change: 1 addition & 0 deletions t/cobrand/northumberland.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ my ($update) = $mech->create_comment_for_problem(
$problem2, $staffuser, 'Title', 'text', 0, 'confirmed', 'fixed',
{ confirmed => $problem2->confirmed->add(days => 1, hours => 3, minutes => 37) }
);
$update->update({ problem_state => '' }); # simulate a questionnaire response which has mark_fixed true and no problem_state


my $UPLOAD_DIR = tempdir( CLEANUP => 1 );
Expand Down

0 comments on commit b68f825

Please sign in to comment.