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

[N/land] Pass category updates to/from Alloy #5289

Open
wants to merge 2 commits into
base: nland-assigned-to-extra-details
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
11 changes: 11 additions & 0 deletions perllib/FixMyStreet/Cobrand/Northumberland.pm
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@
We pass the name and email address of the user assigned to the report (the
user who has shortlisted the report).

We pass any category change.

=cut

sub open311_munge_update_params {
Expand All @@ -264,6 +266,15 @@
= $assigned_to
? $assigned_to->email
: '';

if ( $comment->text =~ /Category changed/ ) {
my $service_code = $p->contact->email;
my $category_group = $p->get_extra_metadata('group');

Check warning on line 272 in perllib/FixMyStreet/Cobrand/Northumberland.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Northumberland.pm#L271-L272

Added lines #L271 - L272 were not covered by tests

$params->{service_code} = $service_code;

Check warning on line 274 in perllib/FixMyStreet/Cobrand/Northumberland.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Northumberland.pm#L274

Added line #L274 was not covered by tests
$params->{'attribute[group]'} = $category_group
if $category_group;
}
}

1;
12 changes: 12 additions & 0 deletions perllib/Open311/UpdatesBase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@
$request->{extras}{detailed_information} )
: $p->unset_extra_metadata('detailed_information');
}

# Category & group
# TODO Do we want to check that category and group match?
if ( my $category = $request->{extras}{category} ) {
my $contact

Check warning on line 233 in perllib/Open311/UpdatesBase.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Open311/UpdatesBase.pm#L233

Added line #L233 was not covered by tests
= $body->contacts->search( { category => $category } )->first;
$p->category($category) if $contact;
}

if ( my $group = $request->{extras}{group} ) {
$p->set_extra_metadata( group => $group );

Check warning on line 239 in perllib/Open311/UpdatesBase.pm

View check run for this annotation

Codecov / codecov/patch

perllib/Open311/UpdatesBase.pm#L239

Added line #L239 was not covered by tests
}
}

my $comment = $self->schema->resultset('Comment')->new(
Expand Down
Loading