Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merton] Use stored item names rather than ID map. #5255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions perllib/FixMyStreet/Cobrand/Merton.pm
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@
if ($h->{sending_to_crimson}) {
# Want to send bulky item names rather than IDs
if ($row->category eq 'Bulky collection') {
my @items_list = @{ $self->bulky_items_master_list };
my %items = map { $_->{bartec_id} => $_->{name} } @items_list;
my @ids = split /::/, $row->get_extra_field_value('Bulky_Collection_Bulky_Items'), -1;
@ids = map { $items{$_} } @ids;
my @fields = sort grep { /^item_\d/ } keys %{$row->get_extra_metadata};
my @ids = map { $row->get_extra_metadata($_) } @fields;

Check warning on line 117 in perllib/FixMyStreet/Cobrand/Merton.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Merton.pm#L116-L117

Added lines #L116 - L117 were not covered by tests
my $ids = join('::', @ids);
$row->update_extra_field({ name => 'Bulky_Collection_Bulky_Items', value => $ids });
push @$open311_only, { name => 'Current_Item_Count', value => scalar @ids };
Expand Down
1 change: 1 addition & 0 deletions t/app/controller/waste_merton_bulky.t
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ FixMyStreet::override_config {
dt => $dt,
});
$report->update_extra_field({ name => 'Bulky_Collection_Bulky_Items', value => '3::83::3' });
$report->set_extra_metadata( item_1 => 'BBQ', item_2 => 'Bath', item_3 => 'BBQ' );
$report->update;

$send->send_reports;
Expand Down
Loading