Skip to content

Commit

Permalink
only show active assigments on overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Nov 2, 2023
1 parent b3dff07 commit c207cd7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions crowdsourcer/fixtures/assignments.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"section": 1,
"authority": 1,
"response_type": 1,
"active": true,
"question": null
}
},
Expand All @@ -18,6 +19,7 @@
"section": 2,
"authority": 2,
"response_type": 1,
"active": true,
"question": null
}
},
Expand All @@ -29,6 +31,7 @@
"section": 2,
"authority": 3,
"response_type": 1,
"active": true,
"question": null
}
},
Expand All @@ -40,6 +43,7 @@
"section": 2,
"authority": 2,
"response_type": 3,
"active": true,
"question": null
}
}
Expand Down
6 changes: 3 additions & 3 deletions crowdsourcer/fixtures/audit_assignments.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"user": 2,
"section": 1,
"authority": 1,
"active": false,
"active": true,
"response_type": 1,
"question": null
}
Expand All @@ -18,7 +18,7 @@
"user": 2,
"section": 2,
"authority": 2,
"active": false,
"active": true,
"response_type": 1,
"question": null
}
Expand All @@ -30,7 +30,7 @@
"user": 2,
"section": 2,
"authority": 3,
"active": false,
"active": true,
"response_type": 1,
"question": null
}
Expand Down
2 changes: 1 addition & 1 deletion crowdsourcer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def is_user_assigned(cls, user, **kwargs):
if user.is_anonymous:
return False

q = cls.objects.filter(user=user)
q = cls.objects.filter(user=user, active=True)

if kwargs.get("section", None) is not None:
q = q.filter(section__title=kwargs["section"])
Expand Down
3 changes: 2 additions & 1 deletion crowdsourcer/views/marking.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def get_queryset(self):
return None

qs = Assigned.objects.filter(
section__isnull=False, response_type=self.current_stage
section__isnull=False,
active=True,
)
if user.is_superuser is False:
qs = qs.filter(user=user)
Expand Down

0 comments on commit c207cd7

Please sign in to comment.