Skip to content

Commit fdfc452

Browse files
committed
various fixes to volunteer progress page
Now uses the response type of the assignment rather than the current stage to determine question types, url etc
1 parent dd628fa commit fdfc452

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

crowdsourcer/templates/crowdsourcer/volunteer_progress.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1 class="mb-4">Volunteer Progress: {{ user.first_name }} {{ user.last_name }}
4949
{% for authority in stats.authorities %}
5050
<tr>
5151
<td>
52-
<a href="{% session_url authority_url_name authority.name section.section.title %}">{{ authority.name }}</a>
52+
<a href="{% session_url stats.authority_url_name authority.name section.section.title %}">{{ authority.name }}</a>
5353
</td>
5454
<td>
5555
<div class="progress progress-thin mb-2">

crowdsourcer/views/progress.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,11 @@ def get_context_data(self, **kwargs):
253253
user = User.objects.get(id=self.kwargs["id"])
254254
progress = []
255255

256-
types = Question.VOLUNTEER_TYPES
257-
258-
if self.request.current_stage.type == "Audit":
259-
types = ["volunteer", "national_volunteer", "foi"]
256+
types = {
257+
"First Mark": Question.VOLUNTEER_TYPES,
258+
"Right of Reply": Question.VOLUNTEER_TYPES,
259+
"Audit": ["volunteer", "national_volunteer", "foi", "national_data"],
260+
}
260261

261262
for section in sections:
262263
section_details = {
@@ -278,7 +279,7 @@ def get_context_data(self, **kwargs):
278279
Question.objects.filter(
279280
section=section,
280281
questiongroup=OuterRef("questiongroup"),
281-
how_marked__in=types,
282+
how_marked__in=types[rt.type],
282283
)
283284
.values("questiongroup")
284285
.annotate(num_questions=Count("pk"))
@@ -292,11 +293,7 @@ def get_context_data(self, **kwargs):
292293
authority=OuterRef("pk"),
293294
response_type=rt,
294295
)
295-
.exclude(
296-
id__in=Response.null_responses(
297-
stage_name=self.request.current_stage.type
298-
)
299-
)
296+
.exclude(id__in=Response.null_responses(stage_name=rt.type))
300297
.values("authority")
301298
.annotate(
302299
response_count=Count("question_id", distinct=True)
@@ -328,9 +325,14 @@ def get_context_data(self, **kwargs):
328325
if a.num_questions == a.num_responses:
329326
council_totals["complete"] = council_totals["complete"] + 1
330327

328+
if rt.type == "First Mark":
329+
authority_url_name = "authority_question_edit"
330+
elif rt.type == "Audit":
331+
authority_url_name = "authority_audit"
331332
section_details["responses"][rt.type] = {
332333
"authorities": authorities,
333334
"totals": council_totals,
335+
"authority_url_name": authority_url_name,
334336
}
335337
section_details["totals"]["total"] += council_totals["total"]
336338
section_details["totals"]["complete"] += council_totals["complete"]

0 commit comments

Comments
 (0)