Skip to content

Commit

Permalink
Fixed crash on Dupe Count sorting with Delta + Dupes Only
Browse files Browse the repository at this point in the history
Fixes #238
  • Loading branch information
Virgil Dupras committed Nov 9, 2013
1 parent 8e65f15 commit ba7e649
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/app.py
Expand Up @@ -183,9 +183,9 @@ def _get_dupe_sort_key(self, dupe, get_group, key, delta):
return self.results.is_marked(dupe)
if key == 'percentage':
m = get_group().get_match_of(dupe)
result = m.percentage
return m.percentage
elif key == 'dupe_count':
result = 0
return 0
else:
result = cmp_value(dupe, key)
if delta:
Expand Down
13 changes: 13 additions & 0 deletions core/tests/app_test.py
Expand Up @@ -399,6 +399,19 @@ def test_selected_dupes_after_removal(self, do_setup):
app.remove_marked()
eq_(len(self.rtable), 0)
eq_(app.selected_dupes, [])

def test_dont_crash_on_delta_powermarker_dupecount_sort(self, do_setup):
# Don't crash when sorting by dupe count or percentage while delta+powermarker are enabled.
# Ref #238
app = self.app
objects = self.objects
self.rtable.delta_values = True
self.rtable.power_marker = True
self.rtable.sort('dupe_count', False)
# don't crash
self.rtable.sort('percentage', False)
# don't crash


class TestCaseDupeGuru_renameSelected:
def pytest_funcarg__do_setup(self, request):
Expand Down

0 comments on commit ba7e649

Please sign in to comment.