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
Resend report if changing to category with different send_method #1772
Resend report if changing to category with different send_method #1772
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1772 +/- ##
==========================================
- Coverage 71.82% 71.81% -0.02%
==========================================
Files 154 154
Lines 9923 9933 +10
Branches 1806 1809 +3
==========================================
+ Hits 7127 7133 +6
- Misses 2133 2134 +1
- Partials 663 666 +3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1772 +/- ##
==========================================
+ Coverage 71.79% 71.81% +0.01%
==========================================
Files 154 154
Lines 9923 9933 +10
Branches 1806 1809 +3
==========================================
+ Hits 7124 7133 +9
Misses 2134 2134
- Partials 665 666 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other that a nice to have extra test this looks good to me.
@@ -847,6 +849,21 @@ sub report_edit_category : Private { | |||
if (grep !$old_map{$_}, @new_body_ids) { | |||
$problem->whensent(undef); | |||
} | |||
# If the send methods of the old/new contacts differ we need to resend the report | |||
my @old_contacts = grep { $_->category eq $category_old } @{$c->stash->{contacts}}; | |||
my @new_send_methods = uniq map { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this uniq map and the old contacts plain map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no, I see, it's because there can only really be one old_contact in there.
is $report3->whensent, undef, "Report marked as unsent"; | ||
is $report3->bodies_str, $oxon->id, "Reported to OCC"; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless it's elsewhere and I'm missing it it'd be nice to see a test that shows changing to a category with the same send method doesn't resend.
If a report’s category is changed to one with a different send_method to the original category, the report needs to be resent. Fixes mysociety/fixmystreetforcouncils#209
a995a4f
to
4eda223
Compare
Good shout on the extra test, I've added that in 4eda223. |
If a report’s category is changed to one with a different send_method to the original category, the report needs to be resent.
Fixes mysociety/fixmystreetforcouncils#209