aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Test.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-09-29 09:55:24 +0100
committerStruan Donald <struan@exo.org.uk>2020-09-30 09:40:13 +0100
commitb6fb09db4ff31aba28833b9e735e6c92ce9081c7 (patch)
tree5241e16f9a26c0743ea466da7add9810cf42da12 /perllib/FixMyStreet/App/Controller/Test.pm
parentf63e2feb37cc9b1e5aca60d85be166fa84eb5f9f (diff)
do not trigger duplicate check with stopper check
The stopper checking code is triggered using the category_change event which, by default also calls the duplicate check code. This meant that when an extra question dropdown with an associated stopper was updated the duplicate check re-ran and the duplicate reports panel was re-shown. The invocation of category_change on the extra questions now includes the skip_duplicates parameter to avoid this. Fixes mysociety/fixmystreet-commercial#2007
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Test.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Test.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Test.pm b/perllib/FixMyStreet/App/Controller/Test.pm
index 5ec4bebf3..19a8c5321 100644
--- a/perllib/FixMyStreet/App/Controller/Test.pm
+++ b/perllib/FixMyStreet/App/Controller/Test.pm
@@ -42,6 +42,25 @@ sub setup : Path('/_test/setup') : Args(1) {
my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
$problem->update({ category => 'Skips' });
$c->response->body("OK");
+ } elsif ( $test eq 'regression-duplicate-stopper') {
+ my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
+ $problem->update({ category => 'Flytipping' });
+ my $category = FixMyStreet::DB->resultset('Contact')->search({
+ category => 'Flytipping',
+ })->first;
+ $category->push_extra_fields({
+ code => 'hazardous',
+ datatype => 'singlevaluelist',
+ description => 'Hazardous material',
+ order => 0,
+ variable => 'true',
+ values => [
+ { key => 'yes', name => 'Yes', disable => 1, disable_message => 'Please phone' },
+ { key => 'no', name => 'No' },
+ ],
+ });
+ $category->update;
+ $c->response->body("OK");
}
}
@@ -51,6 +70,15 @@ sub teardown : Path('/_test/teardown') : Args(1) {
my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
$problem->update({ category => 'Potholes' });
$c->response->body("OK");
+ } elsif ( $test eq 'regression-duplicate-stopper') {
+ my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
+ $problem->update({ category => 'Potholes' });
+ my $category = FixMyStreet::DB->resultset('Contact')->search({
+ category => 'Flytipping',
+ })->first;
+ $category->remove_extra_field('hazardous');
+ $category->update;
+ $c->response->body("OK");
}
}