@@ -274,9 +274,13 @@ class ScoreTypeGroup(ScoreTypeAlone):
274274 </thead>
275275 <tbody>
276276 {% for tc in st["testcases"] %}
277- {% if "outcome" in tc
278- and (feedback_level == FEEDBACK_LEVEL_FULL
279- or tc["show_in_restricted_feedback"]) %}
277+ {% set show_tc = "outcome" in tc
278+ and ((feedback_level == FEEDBACK_LEVEL_FULL)
279+ or (feedback_level == FEEDBACK_LEVEL_RESTRICTED
280+ and tc["show_in_restricted_feedback"])
281+ or (feedback_level == FEEDBACK_LEVEL_OI_RESTRICTED
282+ and tc["show_in_oi_restricted_feedback"])) %}
283+ {% if show_tc %}
280284 {% if tc["outcome"] == "Correct" %}
281285 <tr class="correct">
282286 {% elif tc["outcome"] == "Not correct" %}
@@ -307,16 +311,18 @@ class ScoreTypeGroup(ScoreTypeAlone):
307311 {% endif %}
308312 </tr>
309313 {% else %}
314+ {% if feedback_level != FEEDBACK_LEVEL_OI_RESTRICTED %}
310315 <tr class="undefined">
311316 <td class="idx">{{ loop.index }}</td>
312- {% if feedback_level == FEEDBACK_LEVEL_FULL %}
317+ {% if feedback_level == FEEDBACK_LEVEL_FULL %}
313318 <td colspan="4">
314- {% else %}
319+ {% else %}
315320 <td colspan="2">
316- {% endif %}
321+ {% endif %}
317322 {% trans %}N/A{% endtrans %}
318323 </td>
319324 </tr>
325+ {% endif %}
320326 {% endif %}
321327 {% endfor %}
322328 </tbody>
@@ -412,25 +418,33 @@ def compute_score(self, submission_result):
412418
413419 testcases = []
414420 public_testcases = []
415- previous_tc_all_correct = True
421+ # In "Restricted" feedback mode:
422+ # show until the first testcase with a lowest score
423+ # In "OI Restricted" feedback mode:
424+ # show only the first testcase with a lowest score
425+
426+ tc_first_lowest_idx = None
427+ tc_first_lowest_score = None
416428 for tc_idx in target :
429+ tc_score = float (evaluations [tc_idx ].outcome )
417430 tc_outcome = self .get_public_outcome (
418- float ( evaluations [ tc_idx ]. outcome ) , parameter )
431+ tc_score , parameter )
419432
420433 testcases .append ({
421434 "idx" : tc_idx ,
422435 "outcome" : tc_outcome ,
423436 "text" : evaluations [tc_idx ].text ,
424437 "time" : evaluations [tc_idx ].execution_time ,
425438 "memory" : evaluations [tc_idx ].execution_memory ,
426- "show_in_restricted_feedback" : previous_tc_all_correct })
439+ "show_in_restricted_feedback" : True ,
440+ "show_in_oi_restricted_feedback" : True })
441+
427442 if self .public_testcases [tc_idx ]:
428443 public_testcases .append (testcases [- 1 ])
429- # Only block restricted feedback if this is the first
430- # *public* non-correct testcase, otherwise we might be
431- # leaking info on private testcases.
432- if tc_outcome != "Correct" :
433- previous_tc_all_correct = False
444+ if tc_first_lowest_score is None or \
445+ tc_score < tc_first_lowest_score :
446+ tc_first_lowest_idx = tc_idx
447+ tc_first_lowest_score = tc_score
434448 else :
435449 public_testcases .append ({"idx" : tc_idx })
436450
@@ -439,6 +453,13 @@ def compute_score(self, submission_result):
439453 parameter )
440454 st_score = st_score_fraction * parameter [0 ]
441455
456+ if st_score_fraction < 1.0 :
457+ for tc in testcases :
458+ tc ["show_in_restricted_feedback" ] = (
459+ tc ["idx" ] <= tc_first_lowest_idx )
460+ tc ["show_in_oi_restricted_feedback" ] = (
461+ tc ["idx" ] == tc_first_lowest_idx )
462+
442463 score += st_score
443464 subtasks .append ({
444465 "idx" : st_idx + 1 ,
0 commit comments