Skip to content

Group flagged textanswers by question#2725

Open
just-spafi wants to merge 1 commit into
e-valuation:mainfrom
just-spafi:main
Open

Group flagged textanswers by question#2725
just-spafi wants to merge 1 commit into
e-valuation:mainfrom
just-spafi:main

Conversation

@just-spafi

Copy link
Copy Markdown
Collaborator

Fixes #2711

Comment thread evap/staff/views.py
is_flagged=True,
contribution__evaluation__course__semester=semester,
).order_by("contribution__evaluation")
).order_by("contribution__evaluation", "assignment__questionnaire", "assignment__question")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +3193 to +3195
for i, j in self.flagged_ids:
self.textanswers[i][j].is_flagged = True
self.textanswers[i][j].save()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment on lines +3198 to +3199
for row in self.textanswers:
for textanswer in row:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about that, but was too tired to think about it. I'll see if something breaks, when I change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Show Questions on Flagged Textanswers Page

2 participants