From 13a25b2625f30d1f3c57d28e45abcfb7cf1164d0 Mon Sep 17 00:00:00 2001
From: joshrandall8478 <joshrandall8478@gmail.com>
Date: Tue, 22 Oct 2024 22:01:48 -0400
Subject: [PATCH] added gracePeriod as an environment variable

---
 docker-compose.yml | 1 +
 main.py            | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/docker-compose.yml b/docker-compose.yml
index 9ca10ec..d7735ec 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,6 +8,7 @@ services:
       ASSIGNMENT_TITLE: "Assignment Title"
       SCORE_DEFAULT: 100
       LATE_PENALTY: 8
+      GRACE_PERIOD: "5 Days"
       DEFAULT_LABELS: '["Names", "Steps", "Extra Credit"]'
       DEFAULT_POINTS: '[[10],[15,20],[0]]'
       TEAM: 0
diff --git a/main.py b/main.py
index d443b62..ea50525 100644
--- a/main.py
+++ b/main.py
@@ -24,6 +24,7 @@ global pointsForRun
 global title
 global defaults
 global team
+global gracePeriod
 
 """
 Environment Variable Imports
@@ -32,6 +33,7 @@ Environment Variable Imports
 title = os.getenv("ASSIGNMENT_TITLE", default="Assignment Title")
 scoreDefault = int(os.getenv("SCORE_DEFAULT", default="100")) # What the score is out of
 latePenalty = int(os.getenv("LATE_PENALTY", default="8"))
+gracePeriod = os.getenv("GRACE_PERIOD", default="5 Days")
 
 
 defaults_env = os.getenv("DEFAULT_POINTS", default="[[10],[15,20],[0]]")
@@ -179,7 +181,7 @@ def adjustLate():
     global late
     global score
     global latePenalty
-    onTime = validateInput(input("Did the student turn in the assignment within 5 days? [Y/n]: "))
+    onTime = validateInput(input("Did the student turn in the assignment within " + gracePeriod + "? [Y/n]: "))
     if onTime:
         points = latePenalty
     else:
@@ -337,7 +339,7 @@ def main():
         else:
             plural = ""
         name = input("Student name" + plural + "?: ")
-        late = not validateInput(input("Did the student turn in the assignment within 5 days? [Y/n]: "))
+        late = not validateInput(input("Did the student turn in the assignment within " + gracePeriod + "? [Y/n]: "))
         if(late):
             score = score - latePenalty
 
-- 
GitLab