Subtracting points for late submissions in AutoTest V1

Use AutoTest submission metadata to automatically and flexibly subtract points for late submissions.

One of the most common applications of AutoTest submission metadata is to automatically subtract points for late days. By default, students can not hand in after the deadline, to allow students to do that, turn it on by following the steps in:

pageAllow students to hand in after deadline

In our example, we want to automatically subtract 1 point from the total rubric score for each day after the deadline, up to a maximum of 10 points subtracted:

  1. Set up a rubric category with 11 items ranging from -10 to 0 or a continuous rubric category with a negative lower bound of -10.

  2. Create a new AutoTest category linked to the new rubric category, and check the "Submission information" checkbox under "Advanced options".

  3. Add a "Capture points" step with an appropriate name and the following settings:

    • Program to test: python3.7 $FIXTURES/deadline.py (Note the use of python3.7 instead of python3)

    • Regex to match: \f

  4. Upload the following script as a fixture with the name deadline.py:

    import math
    from cg_at_utils import CG_INFO
    import datetime
    
    ONE_DAY      = datetime.timedelta(days=1)
    deadline     = CG_INFO.deadline
    submitted_at = CG_INFO.submitted_at
    days_late    = math.ceil((submitted_at - deadline) / ONE_DAY)
    
    if days_late <= 0:
        print('submitted on time :)')
        print(1.0)
    elif days_late <= 10:
        print('{} days late'.format(days_late))
        print(1 - days_late / 10)
    else:
        print('very late, maximum penalty')
        print(0.0)

In this example, we are subtracting 1 rubric point per late day. Keep in mind that rubric points are not final grade points, unless your rubric has exactly 10 rubric points.

Last updated