Group flagged textanswers by question - #2725
Conversation
| is_flagged=True, | ||
| contribution__evaluation__course__semester=semester, | ||
| ).order_by("contribution__evaluation") | ||
| ).order_by("contribution__evaluation", "assignment__questionnaire", "assignment__question") |
There was a problem hiding this comment.
The problem with ordering in one place and using regroup in a totally separate place is always that we may change one and forget about the other.
Could just use unordered_groupby here and pass a grouped collection into the template? Then we don't have that issue
| for i, j in self.flagged_ids: | ||
| self.textanswers[i][j].is_flagged = True | ||
| self.textanswers[i][j].save() |
There was a problem hiding this comment.
both tests now do this, I think it would make more sense to move this into the shared setup code (where we also define flagged_ids)
| for row in self.textanswers: | ||
| for textanswer in row: |
There was a problem hiding this comment.
I may just be too tired, but is there any value in having the textanswers be stored in two levels of nested lists here, or could we flatten that to just a one-dimensional list?
There was a problem hiding this comment.
I also thought about that, but was too tired to think about it. I'll see if something breaks, when I change it.
|
@just-spafi do you want to keep working on this, or should we take over / assign this issue to someone else? |
I plan on finishing this in the next two weeks :) |
|
cool, no stress :) (quick heads up if you haven't heard, but tomorrow is one of the rare days on which we won't have a development meeting; we will meet again next week. of course, feel free to reach out on github at any other time too) |
Fixes #2711