changed question sorting from strictly alphabetic from tuple-based sort on sort_id then number

dj111py38
Jamie Campbell 2015-12-08 00:45:24 -06:00
parent 37429dcf32
commit 49aa449a83
2 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ class QuestionSet(models.Model):
def sorted_questions(self):
questions = self.questions()
return sorted(questions, key = lambda question : str(question.sort_id)+question.number)
return sorted(questions, key = lambda question : (question.sort_id, question.number))
def next(self):
qs = self.questionnaire.questionsets()

View File

@ -599,7 +599,7 @@ def show_questionnaire(request, runinfo, errors={}):
substitute_answer(qvalues, runinfo.questionset)
#we make it clear to the user that we're going to sort by sort id then number, so why wasn't it doing that?
questions = sorted(questions, key=lambda question: str(question.sort_id)+question.number)
questions = sorted(questions, key=lambda question: (question.sort_id, question.number))
for question in questions:
# if we got here the questionset will at least contain one question