From a885415e861f4d63550a61c93a55cd0c64848c6e Mon Sep 17 00:00:00 2001 From: John McCann Cunniff Jr Date: Thu, 19 Oct 2023 15:13:16 -0400 Subject: [PATCH] FIX shell autograde ide created --- api/anubis/ide/initialize.py | 3 +++ api/anubis/lms/shell_autograde.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/api/anubis/ide/initialize.py b/api/anubis/ide/initialize.py index 0cf2037ef..70e993e5f 100644 --- a/api/anubis/ide/initialize.py +++ b/api/anubis/ide/initialize.py @@ -1,4 +1,5 @@ import copy +from datetime import datetime from kubernetes import config as k8s_config @@ -23,6 +24,7 @@ from anubis.k8s.theia.create import create_k8s_resources_for_ide from anubis.utils.exceptions import send_alert_email_on_error + @send_alert_email_on_error def initialize_theia_session(theia_session_id: str): """ @@ -151,6 +153,7 @@ def initialize_ide( credentials=credentials, docker=docker, autograde=autograde, + created=datetime.now(), ) db.session.add(session) diff --git a/api/anubis/lms/shell_autograde.py b/api/anubis/lms/shell_autograde.py index 61e1ff27b..ba8583593 100644 --- a/api/anubis/lms/shell_autograde.py +++ b/api/anubis/lms/shell_autograde.py @@ -1,3 +1,4 @@ +from datetime import datetime import re from anubis.constants import SHELL_AUTOGRADE_SUBMISSION_STATE_MESSAGE, SHELL_AUTOGRADE_SUBMISSION_NOT_DONE_MESSAGE @@ -356,6 +357,9 @@ def create_shell_autograde_ide_submission(theia_session: TheiaSession) -> Submis # on the due date of the assignment. accepted = True if not assignment.accept_late: + if theia_session.created is None: + theia_session.created = datetime.now() + # Figure out if the current submission is late late = theia_session.created < get_assignment_due_date( theia_session.owner_id,