Skip to content

Commit

Permalink
Fix CSV export if no report user.
Browse files Browse the repository at this point in the history
If a user only has phone number and we’ve only asked
for email, no user will be available at this point.
  • Loading branch information
dracos committed Jul 25, 2024
1 parent 6d1e8c8 commit ba4fb1b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions perllib/FixMyStreet/Cobrand/BathNES.pm
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ sub dashboard_export_updates_add_columns {
my $staff_user = $self->csv_staff_user_lookup($report->get_extra_metadata('contributed_by'), $user_lookup);

return {
user_email => $report->user->email || '',
user_email => $report->user ? $report->user->email : '',
staff_user => $staff_user,
};
});
Expand Down Expand Up @@ -336,8 +336,8 @@ sub dashboard_export_problems_add_columns {
return {
attribute_data => $attribute_data,
$csv->dbi ? () : (
user_email => $report->user->email || '',
user_phone => $report->user->phone || '',
user_email => $report->user ? $report->user->email : '',
user_phone => $report->user ? $report->user->phone : '',
staff_user => $self->csv_staff_user_lookup($report->get_extra_metadata('contributed_by'), $user_lookup),
),
};
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/Bexley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ sub dashboard_export_problems_add_columns {
my $report = shift;

return {
user_email => $report->user->email || '',
user_email => $report->user ? $report->user->email : '',
};
});
}
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/Camden.pm
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ sub dashboard_export_problems_add_columns {

return {
name => $report->name || '',
user_email => $report->user->email || '',
user_email => $report->user ? $report->user->email : '',
};
});
}
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Cobrand/CyclingUK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ sub dashboard_export_problems_add_columns {
first_name => $first || '',
last_name => $last || '',
$csv->dbi ? () : (
user_email => $report->user->email || '',
user_email => $report->user ? $report->user->email : '',
)
};
});
Expand Down
4 changes: 2 additions & 2 deletions perllib/FixMyStreet/Cobrand/HighwaysEngland.pm
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ sub dashboard_export_problems_add_columns {

my $fields = $initial_extra_data->($report);
$fields->{user_name_display} = $report->name;
$fields->{user_email} = $report->user->email || '';
$fields->{user_phone} = $report->user->phone || '';
$fields->{user_email} = $report->user ? $report->user->email : '';
$fields->{user_phone} = $report->user ? $report->user->phone : '';

my $i = 1;
my @updates = $report->comments->all;
Expand Down

0 comments on commit ba4fb1b

Please sign in to comment.