aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Questionnaire.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-07-11 16:23:42 +0100
committerDave Arter <davea@mysociety.org>2018-07-11 16:23:42 +0100
commit7c3845be8d26778e93a790ad212b230fbd847d43 (patch)
tree7736022c771754185dd5f8db8af7be107c50a5f8 /perllib/FixMyStreet/App/Controller/Questionnaire.pm
parent49fdf020d77bbdaf052cc403fb76f5696bc368ea (diff)
Allow questionnaire pages to be revisited within 2 minutes
Users who double click links were seeing an error when visiting the questionnaire page. This change gives a grace period of two minutes for revisiting the questionnaire page. Fixes #2123.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index 58848f546..696529660 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -33,7 +33,8 @@ sub check_questionnaire : Private {
my $problem = $questionnaire->problem;
- if ( $unanswered && $questionnaire->whenanswered ) {
+ my $cutoff = DateTime->now()->subtract( minutes => 2 );
+ if ( $unanswered && $questionnaire->whenanswered && $questionnaire->whenanswered < $cutoff) {
my $problem_url = $c->cobrand->base_url_for_report( $problem ) . $problem->url;
my $contact_url = $c->uri_for( "/contact" );
my $message = sprintf(_("You have already answered this questionnaire. If you have a question, please <a href='%s'>get in touch</a>, or <a href='%s'>view your problem</a>.\n"), $contact_url, $problem_url);