aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model/problem.t
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 /t/app/model/problem.t
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 't/app/model/problem.t')
-rw-r--r--t/app/model/problem.t2
1 files changed, 2 insertions, 0 deletions
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 718b980b0..b0719d6a6 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -776,6 +776,8 @@ subtest 'check duplicate reports' => sub {
$problem1->set_extra_metadata(duplicate_of => $problem2->id);
$problem1->state('duplicate');
$problem1->update;
+ $problem2->set_extra_metadata(duplicates => [ $problem1->id ]);
+ $problem2->update;
is $problem1->duplicate_of->title, $problem2->title, 'problem1 returns correct problem from duplicate_of';
is scalar @{ $problem2->duplicates }, 1, 'problem2 has correct number of duplicates';