Skip to content

Commit

Permalink
Test Student now has infinite number of attempts.
Browse files Browse the repository at this point in the history
  • Loading branch information
aksholokhov committed Oct 16, 2020
1 parent 322135c commit a73e318
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/gspack/templates/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,14 @@ def get_hint(test, prefix, language):
number_of_attempts = config.get("number_of_attempts", None)
if number_of_attempts is not None:
number_of_used_attempts = len(submission_metadata['previous_submissions'])
if number_of_used_attempts >= number_of_attempts:
results["output"] += f"You've already used all {number_of_attempts} allowed attempts."
dump_results_and_exit(results, print_score=False)
if submission_metadata["users"][0]["name"] == "Test Student":
results["output"] += f"Submitted as Test Student (unlimited attempts)"
else:
results["output"] += f"This is your attempt {number_of_used_attempts + 1} out of {number_of_attempts}. \n"
if number_of_used_attempts >= number_of_attempts:
results["output"] += f"You've already used all {number_of_attempts} allowed attempts."
dump_results_and_exit(results, print_score=False)
else:
results["output"] += f"This is your attempt {number_of_used_attempts + 1} out of {number_of_attempts}. \n"

# get test suite
test_suite, extra_files = pickle.load(open(SOURCE_DIR / TEST_SUITE_DUMP, "rb"))
Expand Down

0 comments on commit a73e318

Please # to comment.