diff options
| author | rr- | 2016-08-14 17:54:15 +0200 |
|---|---|---|
| committer | rr- | 2016-08-14 17:54:15 +0200 |
| commit | ef4af697c49e23927e6557529d5ed0def595ca36 (patch) | |
| tree | 6224b218bd8915bfd53779ec3fb2886beb81cf42 /server | |
| parent | 023ec9a976055da329c016caad1556f56c198a16 (diff) | |
server/tags: fix tag sorting
Brainfart from d6942121e55bd8283fb252eec94d8ee6ae9232b2
Diffstat (limited to 'server')
| -rw-r--r-- | server/szurubooru/func/tags.py | 2 | ||||
| -rw-r--r-- | server/szurubooru/tests/func/test_tags.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/server/szurubooru/func/tags.py b/server/szurubooru/func/tags.py index 19f338a..e92440c 100644 --- a/server/szurubooru/func/tags.py +++ b/server/szurubooru/func/tags.py @@ -63,7 +63,7 @@ def sort_tags(tags): return sorted( tags, key=lambda tag: ( - default_category_name != tag.category.name, + default_category_name == tag.category.name, tag.category.name, tag.names[0].name) ) diff --git a/server/szurubooru/tests/func/test_tags.py b/server/szurubooru/tests/func/test_tags.py index 07c6723..061639c 100644 --- a/server/szurubooru/tests/func/test_tags.py +++ b/server/szurubooru/tests/func/test_tags.py @@ -19,10 +19,10 @@ def _assert_tag_siblings(result, expected_names_and_occurrences): @pytest.mark.parametrize('input,expected_tag_names', [ - ([('a', 'a', True), ('b', 'b', False), ('c', 'c', False)], list('abc')), - ([('c', 'a', True), ('b', 'b', False), ('a', 'c', False)], list('cba')), - ([('a', 'c', True), ('b', 'b', False), ('c', 'a', False)], list('acb')), - ([('a', 'c', False), ('b', 'b', False), ('c', 'a', True)], list('cba')), + ([('a', 'a', True), ('b', 'b', False), ('c', 'c', False)], list('bca')), + ([('c', 'a', True), ('b', 'b', False), ('a', 'c', False)], list('bac')), + ([('a', 'c', True), ('b', 'b', False), ('c', 'a', False)], list('cba')), + ([('a', 'c', False), ('b', 'b', False), ('c', 'a', True)], list('bac')), ]) def test_sort_tags( input, expected_tag_names, tag_factory, tag_category_factory): |