-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
[Surrey] CSV export includes subscribers to the report #5006
base: surrey-cobrand
Are you sure you want to change the base?
Conversation
Adds a column, "Subscribers" which uses the problem alert method to populate the number for subscribers. The original reporter is not automatically subscribed to their own report for Surrey so the figure is those that have subscribed after the report has been created. mysociety/societyworks#4369
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## surrey-cobrand #5006 +/- ##
==================================================
+ Coverage 82.56% 82.60% +0.03%
==================================================
Files 392 392
Lines 30508 30558 +50
Branches 4815 4832 +17
==================================================
+ Hits 25190 25242 +52
+ Misses 3882 3881 -1
+ Partials 1436 1435 -1 ☔ View full report in Codecov by Sentry. |
my $report = shift; | ||
|
||
return { | ||
alerts => $report->alerts || '0', |
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.
As mentioned on Slack this should use Admin::Reports::alerts_for_report
to get the same value as displayed in the admin report edit page.
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.
Just to add note from Slack discussion - this cannot use that either, because that would still be a per-row database lookup, and we can't have any per-row database lookups in this code.
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.
This is going in the right direction, but there's a bit more to be done as currently the all-csv-export
script is broken by this change.
You'll need to add the SQL to do the lookup to CSVExport.pm
and do a $csv->dbi
check in Surrey::dashboard_export_problems_add_columns
. If you look at $EXTRAS
in CSVExport.pm
that has a few examples of how this preprocessing is done for other columns.
my @results = FixMyStreet::DB->resultset('Alert')->search({ | ||
alert_type => 'new_updates', | ||
confirmed => 1, | ||
cobrand => $self->moniker, |
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.
This criteria means any alerts created on fixmystreet.com won't be included in the CSV count (but will be in the value shown on report admin page) - is that intentional?
Adds a column, "Subscribers" which uses the problem alert method to populate the number for subscribers.
The original reporter is not automatically subscribed to their own report for Surrey so the figure is those that have subscribed after the report has been created.
Also adds initial test file
https://github.com/mysociety/societyworks/issues/4369
[skip changelog]