From 7c1ee4481c620293e8f608789b8768a8ca48d6fc Mon Sep 17 00:00:00 2001 From: Gregory Bell Date: Mon, 2 Oct 2023 12:59:40 -0600 Subject: [PATCH] Fixed big brain math error --- Bartik/Bartik.py | 8 ++++++-- Grade/gradesheets.py | 4 ++-- UI/bartikGrading.py | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Bartik/Bartik.py b/Bartik/Bartik.py index 8ebed3d..88fbf9f 100644 --- a/Bartik/Bartik.py +++ b/Bartik/Bartik.py @@ -87,9 +87,13 @@ def getScoreForAssignment(self, _email: str, _assessment: str, requiredProblems: totalScore: float = 0 for grade in grades: - totalScore += grade.score // 10 if grade is not None else 0 + totalScore += grade.score if grade is not None else 0 - totalScore = (totalScore / requiredProblems) * 10 + # bartik reports scores out of 10 per problem, scale down so they are now out of 1 + + totalScore /= 10 + + totalScore = round((totalScore / requiredProblems) * maxScore, 2) return totalScore if totalScore <= maxScore else maxScore diff --git a/Grade/gradesheets.py b/Grade/gradesheets.py index 1eef929..5e8de06 100644 --- a/Grade/gradesheets.py +++ b/Grade/gradesheets.py @@ -16,7 +16,7 @@ from Bartik.Bartik import Bartik from AzureAD import AzureAD -async def convertBartikToGradesheet(_azure: AzureAD, _bartik: Bartik, _students: pd.DataFrame, _assignment: str) -> pd.DataFrame: +async def convertBartikToGradesheet(_azure: AzureAD, _bartik: Bartik, _students: pd.DataFrame, _assignment: str, _maxPoints: float, _requiredProbems: int) -> pd.DataFrame: bartikGradesheet: pd.DataFrame = pd.DataFrame() bartikGradesheet['multipass'] = "" bartikGradesheet['Total Score'] = "" @@ -40,7 +40,7 @@ async def convertBartikToGradesheet(_azure: AzureAD, _bartik: Bartik, _students: score: float = 0 try: - score = _bartik.getScoreForAssignment(studentEmail, _assignment) + score = _bartik.getScoreForAssignment(studentEmail, _assignment, _requiredProbems, _maxPoints) except Exception: missing = True print(f"Missing") diff --git a/UI/bartikGrading.py b/UI/bartikGrading.py index 653d522..c8924ef 100644 --- a/UI/bartikGrading.py +++ b/UI/bartikGrading.py @@ -14,8 +14,9 @@ async def bartikGrading(canvas, azure, bartik, **kwargs) -> bool: for i, row in assignmentsToGrade.iterrows(): print("=" * 4, f"Now grading {row['name']}", "=" * 4) studioNumber: str = uiHelpers.getUserInput("studio number") + requiredProblems: int = int(uiHelpers.getUserInput("required problems")) - bartikAssignmentsToGrade[row['id']] = await gradesheets.convertBartikToGradesheet(azure, bartik, canvas.getStudents(), studioNumber) + bartikAssignmentsToGrade[row['id']] = await gradesheets.convertBartikToGradesheet(azure, bartik, canvas.getStudents(), studioNumber, row['points'], requiredProblems) print("\nGrades have been generated. Would you like to continue?")