From 1bdef6cf43c1c6bd8f58a2533468db09b098213c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 15 Aug 2017 17:35:53 +0100 Subject: 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. --- t/app/model/problem.t | 2 ++ 1 file changed, 2 insertions(+) (limited to 't/app/model/problem.t') 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'; -- cgit v1.2.3