Skip to content

Commit

Permalink
prevent sorting on keys that can have None values from breaking albums
Browse files Browse the repository at this point in the history
  • Loading branch information
DamourYouKnow committed Dec 2, 2018
1 parent 66724e0 commit 59d976d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.3.1 | 2018-12-02

### Fixed
- Sorting by main unit and sub unit no longer breaks your album.

## 1.3.0 | 2018-12-01

### Added
Expand Down
6 changes: 5 additions & 1 deletion commands/album_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ def _apply_sort(album: list, user: User) -> list:
'sub_unit'
]

return sorted(album, key=itemgetter(sort, 'id'), reverse=sort_descending)
sorted_list = sorted(
filter(lambda card: card[sort], album),
key=itemgetter(sort, 'id'),
reverse=sort_descending)
return sorted_list + [card for card in album if not card[sort]]


def _splice_page(album: list, user: User) -> list:
Expand Down

0 comments on commit 59d976d

Please sign in to comment.