aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-08-15 17:35:53 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-17 10:58:30 +0100
commit1bdef6cf43c1c6bd8f58a2533468db09b098213c (patch)
tree4f76b1cb8e2bd14018c97db4b951997b4abfc318 /perllib/FixMyStreet/App/Controller
parent60b941bc7868c4b0a829f7d497262015d6ab69c4 (diff)
Store duplicate reverse lookups upon dupe setting.
This avoids the need to search the whole table to find a report's duplicates. And is easier than constructing an index or upgrading PostgreSQL.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 5c64bd9e5..acc6f9a09 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -325,7 +325,7 @@ sub inspect : Private {
my %update_params = ();
if ($permissions->{report_inspect}) {
- foreach (qw/detailed_information traffic_information duplicate_of/) {
+ foreach (qw/detailed_information traffic_information/) {
$problem->set_extra_metadata( $_ => $c->get_param($_) );
}
@@ -360,7 +360,10 @@ sub inspect : Private {
}
if ( $problem->state ne 'duplicate' ) {
$problem->unset_extra_metadata('duplicate_of');
+ } elsif (my $duplicate_of = $c->get_param('duplicate_of')) {
+ $problem->set_duplicate_of($duplicate_of);
}
+
if ( $problem->state ne $old_state ) {
$c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'state_change' ] );