allow the same duplicate/merge to be suggested multiple times - #2782
Conversation
| from duplicates.models import DuplicateSuggestion | ||
|
|
||
|
|
||
| def get_previous_rejections(pairs): |
There was a problem hiding this comment.
I was in two minds about whether this should assume the pairs are ordered (low, high) or accept them in any order.
I decided to go with assuming they're in (low, high) order because it makes it simpler what the function should return.
To work an example, lets say there is a DuplicateSuggestion record DuplicateSuggestion(person=1, other_person=2)
The way this works now, get_previous_rejections([(1,2)]) returns {(1,2): [DuplicateSuggestion(person=1, other_person=2)]} and get_previous_rejections([(2,1)]) returns {}
If I make it so that get_previous_rejections([(2,1)]) matches that record too it is ambiguous to me whether the output should be:
{
(1,2): [DuplicateSuggestion(person=1, other_person=2)]
}
or
{
(2,1): [DuplicateSuggestion(person=1, other_person=2)]
}
or
{
(1,2): [DuplicateSuggestion(person=1, other_person=2)],
(2,1): [DuplicateSuggestion(person=1, other_person=2)],
}
I feel like saying "the inputs have to be ordered and so is the output" just makes things simpler.
I could change it though, if we want.
There was a problem hiding this comment.
Yeah, we decided to always go with ordered in the rest of this feature, so let's stick with that here. I think it also makes it clearer that high IDs always merge down to low IDs
059be22 to
cb59a85
Compare
Refs https://app.asana.com/1/1204880536137786/project/1204880927741389/task/1214041815638938?focus=true
This PR:
DuplicateSuggestionfor the same pair of people. You still can't have a duplicate if one is openExample output:
This PR is mostly Claude with a bit of my own guidance/judgement/review.