Skip to content

Commit

Permalink
fix(structure): return table rows in sorted fashion
Browse files Browse the repository at this point in the history
This is not strictly required for the structure module's purpose, but
some tests may depend on evaluation order, so we sort it explicitly.
  • Loading branch information
David Vogt committed Apr 27, 2020
1 parent fbfdfae commit aa0f725
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions caluma/caluma_form/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from functools import singledispatch
from typing import Optional

from .models import Question
from .models import AnswerDocument, Question


def object_local_memoise(method):
Expand Down Expand Up @@ -112,14 +112,15 @@ def children(self):
if not self.answer:
return [] # pragma: no cover

rows = AnswerDocument.objects.filter(answer=self.answer).order_by("sort")
return [
FieldSet(
row_doc,
ans_doc.document,
self.question.row_form,
question=self.question,
parent=self.parent(),
)
for row_doc in self.answer.documents.all()
for ans_doc in rows
]


Expand Down

0 comments on commit aa0f725

Please sign in to comment.