From a8ed422453f159a4b742cbdf2fb41fa7e86a3824 Mon Sep 17 00:00:00 2001 From: Joshua Randall <joshrandall8478@gmail.com> Date: Tue, 25 Mar 2025 16:56:53 -0400 Subject: [PATCH] experimenting with a build for jiang --- ...ckerfile => gradingscript-jiang.dockerfile | 0 main.py | 31 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) rename gradingscript.dockerfile => gradingscript-jiang.dockerfile (100%) diff --git a/gradingscript.dockerfile b/gradingscript-jiang.dockerfile similarity index 100% rename from gradingscript.dockerfile rename to gradingscript-jiang.dockerfile diff --git a/main.py b/main.py index 03719b4..4cc61fa 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,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")) +latePenalty = float(os.getenv("LATE_PENALTY", default="0.8")) gracePeriod = os.getenv("GRACE_PERIOD", default="5 Days") @@ -166,6 +166,12 @@ def validateInput(answer): return False else: return True + +def validateInputNoDefault(answer): + if answer == "y" or answer == "Y": + return True + else: + return False def addToScore(boolean, number): global score @@ -181,11 +187,18 @@ def adjustLate(): global late global score global latePenalty - onTime = validateInput(input("Did the student turn in the assignment within " + gracePeriod + "? [Y/n]: ")) + pastLatePenalty = latePenalty + onTime = not(validateInputNoDefault(input("Did the student turn in the assignment late? [y/N]: "))) + if(not onTime): + superLate = validateInputNoDefault(input("Was it turned in past a week? [y/N]: ")) + if(superLate): + latePenalty = 0.6 + else: + latePenalty = 0.8 if onTime: - points = latePenalty + points = scoreDefault - (score * pastLatePenalty) else: - points = -latePenalty + points = -(scoreDefault - (score * latePenalty)) if onTime == late: score = score + points late = not onTime @@ -339,9 +352,13 @@ def main(): else: plural = "" name = input("Student name" + plural + "?: ") - late = not validateInput(input("Did the student turn in the assignment within " + gracePeriod + "? [Y/n]: ")) + late = validateInputNoDefault(input("Did the student turn in the assignment late? [y/N]: ")) if(late): - score = score - latePenalty + superLate = validateInputNoDefault(input("Was it turned in past a week? [y/N]: ")) + if(superLate): + latePenalty = 0.6 + else: + latePenalty = 0.8 scoreLoop = True; scoring = True; @@ -353,6 +370,8 @@ def main(): print() if scoring: runScore() + if(late): + score = (score * latePenalty) scoring = False else: # scoreText = Figlet(font='slant') -- GitLab