Skip to content

Commit

Permalink
[Merton] Use stored item names rather than ID map.
Browse files Browse the repository at this point in the history
Multiple items are using the same ID.
  • Loading branch information
dracos committed Dec 6, 2024
1 parent 904c436 commit 287f7d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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 @@ sub open311_extra_data_include {
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;
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

0 comments on commit 287f7d2

Please sign in to comment.