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

Resend report if changing to category with different send_method #1772

Merged
merged 2 commits into from Jul 26, 2017

Conversation

davea
Copy link
Member

@davea davea commented Jul 25, 2017

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

@davea davea requested a review from struan July 25, 2017 15:50
@codecov
Copy link

codecov bot commented Jul 25, 2017

Codecov Report

Merging #1772 into master will decrease coverage by 0.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
perllib/FixMyStreet/TestMech.pm 93.06% <100%> (ø) ⬆️
perllib/FixMyStreet/App/Controller/Admin.pm 71.07% <90%> (+0.22%) ⬆️
perllib/FixMyStreet/Geocode/OSM.pm 45% <0%> (-2.5%) ⬇️
perllib/FixMyStreet/Geocode.pm 80% <0%> (-2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fb659d...a995a4f. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 25, 2017

Codecov Report

Merging #1772 into master will increase coverage by 0.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
perllib/FixMyStreet/TestMech.pm 93.06% <100%> (ø) ⬆️
perllib/FixMyStreet/App/Controller/Admin.pm 71.07% <90%> (+0.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5b740c...4eda223. Read the comment docs.

Copy link
Member

@struan struan left a 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 {
Copy link
Member

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?

Copy link
Member

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";
};

Copy link
Member

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
@davea davea force-pushed the issues/forcouncils/209-resend-upon-category-change branch from a995a4f to 4eda223 Compare July 26, 2017 15:00
@davea davea merged commit 4eda223 into master Jul 26, 2017
@davea davea removed the Reviewing label Jul 26, 2017
@davea
Copy link
Member Author

davea commented Jul 26, 2017

Good shout on the extra test, I've added that in 4eda223.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants