Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions backend/answers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ def attachment_name(self):
)

def sort_key(self):
month_val = next((val for month, val in {"december": 0.4, "august": 0.3, "may": 0.2, "april": 0.1}.items()
if month in self.displayname.lower()), 0)
end = 0
while (
end + 1 < len(self.displayname) and self.displayname[-end - 1 :].isdigit()
):
end += 1
if end == 0:
return 0, self.displayname
return int(self.displayname[-end:]), self.displayname
return month_val, self.displayname
return int(self.displayname[-end:])+month_val, self.displayname

def count_answered(self):
return self.answersection_set.filter(
Expand Down