diff options
-rwxr-xr-x | bin/send-failure-summary (renamed from bin/send-reports-failure-summary) | 11 | ||||
-rw-r--r-- | conf/crontab-example | 2 | ||||
-rw-r--r-- | docs/_includes/footer.html | 11 | ||||
-rw-r--r-- | docs/_layouts/pro.html | 9 | ||||
-rwxr-xr-x | perllib/Open311/PostServiceRequestUpdates.pm | 22 | ||||
-rw-r--r-- | t/open311/post-service-request-updates.t | 4 | ||||
-rw-r--r-- | templates/web/fixmystreet.com/footer_extra.html | 7 | ||||
-rw-r--r-- | templates/web/hounslow/about/mapterms.html | 2 | ||||
-rw-r--r-- | templates/web/isleofwight/about/mapterms.html | 2 |
9 files changed, 55 insertions, 15 deletions
diff --git a/bin/send-reports-failure-summary b/bin/send-failure-summary index c7a5b4086..1a435dc7c 100755 --- a/bin/send-reports-failure-summary +++ b/bin/send-failure-summary @@ -1,9 +1,8 @@ #!/usr/bin/env perl -# send-reports-failure-summary: -# Prints a summary of report sending failures +# send-failure-summary: +# Prints a summary of report/update sending failures -use strict; use warnings; use v5.14; @@ -15,6 +14,12 @@ BEGIN { } use FixMyStreet::Script::Reports; +use Open311::PostServiceRequestUpdates; +# report summary my $manager = FixMyStreet::Script::Reports->new; $manager->end_summary_failures; + +# updates summary +my $updates = Open311::PostServiceRequestUpdates->new; +$updates->summary_failures; diff --git a/conf/crontab-example b/conf/crontab-example index 86fcee80c..568b07e2e 100644 --- a/conf/crontab-example +++ b/conf/crontab-example @@ -12,7 +12,7 @@ PATH=/usr/local/bin:/usr/bin:/bin # send-reports has three rows so that its 8am entry can be run with --verbose to send a morning summary of anything that's gone wrong */5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" -0 8 * * * "$FMS/bin/send-reports-failure-summary" +0 8 * * * "$FMS/bin/send-failure-summary" 2 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-alerts.lock" "$FMS/bin/send-alerts" || echo "stalled?" 22,52 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-questionnaires.lock" "$FMS/bin/send-questionnaires" || echo "stalled?" diff --git a/docs/_includes/footer.html b/docs/_includes/footer.html index 25ffa94a7..d7260aaa7 100644 --- a/docs/_includes/footer.html +++ b/docs/_includes/footer.html @@ -25,7 +25,7 @@ <div class="col-sm-3"> <div class="mysoc-footer__donate"> <p>Your donations keep this site and others like it running</p> - <a href="https://www.mysociety.org/donate?utm_source=fixmystreet.org&utm_content=footer+donate+now&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__donate__button">Donate now</a> + <a href="https://www.mysociety.org/donate?utm_source=fixmystreet.org&utm_content=footer+donate+now&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__donate__button">Donate now</a> </div> </div> @@ -37,14 +37,19 @@ <div class="mysoc-footer__orgs"> <p class="mysoc-footer__org"> Built by - <a href="https://www.mysociety.org?utm_source=fixmystreet.org&utm_content=footer+logo&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__org__logo mysoc-footer__org__logo--mysociety">mySociety</a> + <a href="https://www.mysociety.org?utm_source=fixmystreet.org&utm_content=footer+logo&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__org__logo mysoc-footer__org__logo--mysociety">mySociety</a> </p> </div> </div> <div class="col-sm-4"> <div class="mysoc-footer__legal"> - <p>mySociety Limited is a project of UK Citizens Online Democracy, a registered charity in England and Wales. For full details visit <a href="https://www.mysociety.org?utm_source=fixmystreet.org&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mysociety.org</a>.</p> + <p> + <a href="https://www.mysociety.org?utm_source=fixmystreet.org&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mySociety</a> + is a registered charity in England and Wales (1076346) + and a limited company (03277032). Through our trading subsidiary + SocietyWorks (05798215) we also provide commercial services. + </p> </div> </div> diff --git a/docs/_layouts/pro.html b/docs/_layouts/pro.html index d04446a6e..f1e764c8b 100644 --- a/docs/_layouts/pro.html +++ b/docs/_layouts/pro.html @@ -137,14 +137,15 @@ <hr class="mysoc-footer__divider" role="presentation"> <div class="row"> <div class="col-sm-4"> - <a href="https://www.mysociety.org?utm_source=fixmystreet.com/pro&utm_content=footer+logo&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__org__logo mysoc-footer__org__logo--mysociety">mySociety</a> + <a href="https://www.mysociety.org?utm_source=fixmystreet.com%2Fpro&utm_content=footer+logo&utm_medium=link&utm_campaign=mysoc_footer" class="mysoc-footer__org__logo mysoc-footer__org__logo--mysociety">mySociety</a> </div> <div class="col-sm-6"> <div class="mysoc-footer__legal"> <p> - mySociety Limited is a project of UK Citizens Online Democracy, - a registered charity in England and Wales. For full details visit - <a href="https://www.mysociety.org?utm_source=fixmystreet.com/pro&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mysociety.org</a>. + <a href="https://www.societyworks.org?utm_source=fixmystreet.com%2Fpro&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">SocietyWorks</a> + is a limited company (05798215). It is a trading subsidiary of + <a href="https://www.mysociety.org?utm_source=fixmystreet.com%2Fpro&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mySociety</a>, + a registered charity in England and Wales (1076346). </p> </div> </div> diff --git a/perllib/Open311/PostServiceRequestUpdates.pm b/perllib/Open311/PostServiceRequestUpdates.pm index fadd063da..68823343c 100755 --- a/perllib/Open311/PostServiceRequestUpdates.pm +++ b/perllib/Open311/PostServiceRequestUpdates.pm @@ -141,6 +141,28 @@ sub process_update { } } +sub summary_failures { + my $self = shift; + my $bodies = $self->fetch_bodies; + my $params = $self->construct_query(1); + my $u = FixMyStreet::DB->resultset("Comment") + ->to_body([ keys %$bodies ]) + ->search({ "me.send_fail_count" => { '>', 0 } }) + ->search($params, { join => "problem" }); + + my $base_url = FixMyStreet->config('BASE_URL'); + my $sending_errors; + while (my $row = $u->next) { + my $url = $base_url . "/report/" . $row->problem_id; + $sending_errors .= "\n" . '=' x 80 . "\n\n" . "* $url, update " . $row->id . " failed " + . $row->send_fail_count . " times, last at " . $row->send_fail_timestamp + . ", reason " . $row->send_fail_reason . "\n"; + } + if ($sending_errors) { + print '=' x 80 . "\n\n" . "The following updates failed sending:\n$sending_errors"; + } +} + sub log { my ($self, $comment, $msg) = @_; return unless $self->verbose; diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t index adfd4e3c5..71bba4af7 100644 --- a/t/open311/post-service-request-updates.t +++ b/t/open311/post-service-request-updates.t @@ -1,12 +1,13 @@ #!/usr/bin/env perl use FixMyStreet::TestMech; +use Test::Output; my $mech = FixMyStreet::TestMech->new; use_ok( 'Open311::PostServiceRequestUpdates' ); -my $o = Open311::PostServiceRequestUpdates->new( site => 'fixmystreet.com' ); +my $o = Open311::PostServiceRequestUpdates->new; my $params = { send_method => 'Open311', @@ -130,6 +131,7 @@ subtest 'Oxfordshire gets an ID' => sub { $o->send; $c2->discard_changes; is $c2->send_fail_count, 1, 'Oxfordshire update tried to send, failed'; + stdout_like { $o->summary_failures } qr/The following updates failed sending/; }; }; diff --git a/templates/web/fixmystreet.com/footer_extra.html b/templates/web/fixmystreet.com/footer_extra.html index 699d7de8b..b1cb0572e 100644 --- a/templates/web/fixmystreet.com/footer_extra.html +++ b/templates/web/fixmystreet.com/footer_extra.html @@ -70,7 +70,12 @@ <div class="col-sm-4"> <div class="mysoc-footer__legal"> - <p>mySociety Limited is a project of UK Citizens Online Democracy, a registered charity in England and Wales. For full details visit <a href="https://www.mysociety.org?utm_source=fixmystreet.com&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mysociety.org</a>.</p> + <p> + <a href="https://www.societyworks.org?utm_source=fixmystreet.com&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">SocietyWorks</a> + is a limited company (05798215). It is a trading subsidiary of + <a href="https://www.mysociety.org?utm_source=fixmystreet.com&utm_content=footer+full+legal+details&utm_medium=link&utm_campaign=mysoc_footer">mySociety</a>, + a registered charity in England and Wales (1076346). + </p> </div> </div> diff --git a/templates/web/hounslow/about/mapterms.html b/templates/web/hounslow/about/mapterms.html index 04c0aeb09..fe08dcdd1 100644 --- a/templates/web/hounslow/about/mapterms.html +++ b/templates/web/hounslow/about/mapterms.html @@ -8,7 +8,7 @@ <li> I. You are granted a non-exclusive, royalty free revocable licence solely to view the licensed data for non-commercial purposes for the - period during which mySociety Ltd. makes it available; + period during which SocietyWorks Ltd. makes it available; </li> <li> II. You are not permitted to copy, sub-license, distribute, sell or diff --git a/templates/web/isleofwight/about/mapterms.html b/templates/web/isleofwight/about/mapterms.html index 04c0aeb09..fe08dcdd1 100644 --- a/templates/web/isleofwight/about/mapterms.html +++ b/templates/web/isleofwight/about/mapterms.html @@ -8,7 +8,7 @@ <li> I. You are granted a non-exclusive, royalty free revocable licence solely to view the licensed data for non-commercial purposes for the - period during which mySociety Ltd. makes it available; + period during which SocietyWorks Ltd. makes it available; </li> <li> II. You are not permitted to copy, sub-license, distribute, sell or |