diff --git a/cms/grading/scoretypes/abc.py b/cms/grading/scoretypes/abc.py index 930fc6cd9..d5a22c8b3 100644 --- a/cms/grading/scoretypes/abc.py +++ b/cms/grading/scoretypes/abc.py @@ -392,10 +392,13 @@ def compute_score(self, submission_result): testcases = [] public_testcases = [] - previous_tc_all_correct = True + + restricted_feedback_idx = None + restricted_feedback_outcome = None + for tc_idx in target: - tc_outcome = self.get_public_outcome( - float(evaluations[tc_idx].outcome), parameter) + outcome = float(evaluations[tc_idx].outcome) + tc_outcome = self.get_public_outcome(outcome, parameter) testcases.append({ "idx": tc_idx, @@ -403,14 +406,13 @@ def compute_score(self, submission_result): "text": evaluations[tc_idx].text, "time": evaluations[tc_idx].execution_time, "memory": evaluations[tc_idx].execution_memory, - "show_in_restricted_feedback": previous_tc_all_correct}) + "show_in_restricted_feedback": True}) if self.public_testcases[tc_idx]: public_testcases.append(testcases[-1]) - # Only block restricted feedback if this is the first - # *public* non-correct testcase, otherwise we might be - # leaking info on private testcases. - if tc_outcome != "Correct": - previous_tc_all_correct = False + + if restricted_feedback_outcome is None or outcome < restricted_feedback_outcome: + restricted_feedback_outcome = outcome + restricted_feedback_idx = tc_idx else: public_testcases.append({"idx": tc_idx}) @@ -419,6 +421,10 @@ def compute_score(self, submission_result): parameter) st_score = st_score_fraction * parameter[0] + if st_score_fraction < 1.0 and parameter[0] > 0: # display full feedback for sample cases + for t in testcases: + t["show_in_restricted_feedback"] = (t["idx"] <= restricted_feedback_idx) + score += st_score subtasks.append({ "idx": st_idx + 1,