1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Don't allow dupes from ref folders to step down from their ref position during reprioritization.

This commit is contained in:
Virgil Dupras
2011-09-23 13:14:57 -04:00
parent 11aa2c147c
commit 9fac97c147
6 changed files with 28 additions and 14 deletions

View File

@@ -290,7 +290,8 @@ class Group:
def prioritize(self, key_func, tie_breaker=None):
# tie_breaker(ref, dupe) --> True if dupe should be ref
self.ordered.sort(key=key_func)
master_key_func = lambda x: (-x.is_ref, key_func(x))
self.ordered.sort(key=master_key_func)
if tie_breaker is None:
return
ref = self.ref
@@ -318,6 +319,8 @@ class Group:
pass
def switch_ref(self, with_dupe):
if self.ref.is_ref:
return
try:
self.ordered.remove(with_dupe)
self.ordered.insert(0, with_dupe)