Skip to content

Commit

Permalink
fix: do not show empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Nov 2, 2023
1 parent e97188d commit 5abd8e0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions feedback/extensions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def load_blocks(request, course):
)

vote_aggregate = []

if not block.vote_aggregate:
block.vote_aggregate = [0] * len(block.get_prompt()["scale_text"])
for i, vote in enumerate(block.vote_aggregate):
vote_aggregate.append(
{
Expand Down Expand Up @@ -137,12 +140,12 @@ def load_xblock_answers(request, students, course_id, block_id, course):
)
if student_xblock_instance:
prompt = student_xblock_instance.get_prompt()
if student_xblock_instance.user_vote == -1 and not student_xblock_instance.user_freeform:
continue
answers.append(
{
"username": username,
"user_vote": prompt["scale_text"][
student_xblock_instance.user_vote
],
"user_vote": prompt["scale_text"][student_xblock_instance.user_vote],
"user_freeform": student_xblock_instance.user_freeform,
}
)
Expand Down

0 comments on commit 5abd8e0

Please sign in to comment.