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

Centralise update creation to include fields. #3111

Merged
merged 1 commit into from Jul 15, 2020

Conversation

dracos
Copy link
Member

@dracos dracos commented Jul 10, 2020

Given the user, we can infer the name if not provided, and the extra
data if a staff user. We can also provide defaults for various other
fields. Always have superuser take precedence over from_body.

@dracos dracos requested a review from struan July 10, 2020 16:18
@codecov
Copy link

codecov bot commented Jul 10, 2020

Codecov Report

Merging #3111 into master will increase coverage by 0.02%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3111      +/-   ##
==========================================
+ Coverage   83.39%   83.42%   +0.02%     
==========================================
  Files         248      248              
  Lines       15571    15574       +3     
  Branches     2907     2906       -1     
==========================================
+ Hits        12986    12992       +6     
  Misses       1660     1660              
+ Partials      925      922       -3     
Impacted Files Coverage Δ
...erllib/FixMyStreet/App/Controller/Admin/Reports.pm 84.54% <ø> (-0.42%) ⬇️
perllib/FixMyStreet/App/Controller/Moderate.pm 89.71% <0.00%> (ø)
...erllib/FixMyStreet/App/Controller/Questionnaire.pm 92.36% <ø> (ø)
perllib/FixMyStreet/App/Controller/Report.pm 88.23% <ø> (+0.27%) ⬆️
perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm 83.87% <ø> (+1.05%) ⬆️
perllib/Open311/UpdatesBase.pm 86.48% <ø> (ø)
perllib/FixMyStreet/App/Controller/Admin/Triage.pm 87.30% <100.00%> (+0.53%) ⬆️
perllib/FixMyStreet/DB/Result/Comment.pm 88.46% <100.00%> (+2.25%) ⬆️

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 eed6158...67823bc. 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.

Teeny comment that I think is not important, otherwise, yay for less repetition.

@@ -206,16 +206,12 @@ sub submit_standard : Private {
$update = $c->model('DB::Comment')->new(
{
problem => $problem,
name => $problem->name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the off chance they've used a different name subsequent to making the report removing this will change the behaviour. I'm not sure it's worth being concerned about though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I spotted that, then I thought might be better anyway to use the name currently associated with the account filling it in at the time it's filled in 👍

Given the user, we can infer the name if not provided, and the extra
data if a staff user. We can also provide defaults for various other
fields. Always have superuser take precedence over from_body.
@dracos dracos force-pushed the record-body-update-everywhere branch from 82436e3 to 67823bc Compare July 14, 2020 17:25
@dracos dracos merged commit 67823bc into master Jul 15, 2020
@github-pages github-pages bot temporarily deployed to github-pages July 15, 2020 09:32 Inactive
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