@@ -253,10 +253,11 @@ def get_context_data(self, **kwargs):
253
253
user = User .objects .get (id = self .kwargs ["id" ])
254
254
progress = []
255
255
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
+ }
260
261
261
262
for section in sections :
262
263
section_details = {
@@ -278,7 +279,7 @@ def get_context_data(self, **kwargs):
278
279
Question .objects .filter (
279
280
section = section ,
280
281
questiongroup = OuterRef ("questiongroup" ),
281
- how_marked__in = types ,
282
+ how_marked__in = types [ rt . type ] ,
282
283
)
283
284
.values ("questiongroup" )
284
285
.annotate (num_questions = Count ("pk" ))
@@ -292,11 +293,7 @@ def get_context_data(self, **kwargs):
292
293
authority = OuterRef ("pk" ),
293
294
response_type = rt ,
294
295
)
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 ))
300
297
.values ("authority" )
301
298
.annotate (
302
299
response_count = Count ("question_id" , distinct = True )
@@ -328,9 +325,14 @@ def get_context_data(self, **kwargs):
328
325
if a .num_questions == a .num_responses :
329
326
council_totals ["complete" ] = council_totals ["complete" ] + 1
330
327
328
+ if rt .type == "First Mark" :
329
+ authority_url_name = "authority_question_edit"
330
+ elif rt .type == "Audit" :
331
+ authority_url_name = "authority_audit"
331
332
section_details ["responses" ][rt .type ] = {
332
333
"authorities" : authorities ,
333
334
"totals" : council_totals ,
335
+ "authority_url_name" : authority_url_name ,
334
336
}
335
337
section_details ["totals" ]["total" ] += council_totals ["total" ]
336
338
section_details ["totals" ]["complete" ] += council_totals ["complete" ]
0 commit comments