Skip to content

Commit

Permalink
Fixed big brain math error
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Bell committed Oct 2, 2023
1 parent 041aafa commit 7c1ee44
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Bartik/Bartik.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Grade/gradesheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = ""
Expand All @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion UI/bartikGrading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?")
Expand Down

0 comments on commit 7c1ee44

Please sign in to comment.