Commit 52c37d174f9f637c30c6ac41106be5576cead790
1 parent
dc685f1923
Exists in
master
Strip letters from right side of course numbers when searching
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
flashcards/models.py
View file @
52c37d1
... | ... | @@ -172,7 +172,7 @@ |
172 | 172 | qs = cls.objects.filter(final_q) |
173 | 173 | # Have the database cast the course number to an integer so it will sort properly |
174 | 174 | # ECE 35 should rank before ECE 135 even though '135' < '35' lexicographically |
175 | - qs = qs.extra(select={'course_num_int': 'CAST(course_num AS INTEGER)'}) | |
175 | + qs = qs.extra(select={'course_num_int': "CAST(rtrim(course_num, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') AS INTEGER)"}) | |
176 | 176 | qs = qs.order_by('department_abbreviation', 'course_num_int') |
177 | 177 | return qs |
178 | 178 |