diff --git a/Bartik/Bartik.py b/Bartik/Bartik.py index 88fbf9f..ae17440 100644 --- a/Bartik/Bartik.py +++ b/Bartik/Bartik.py @@ -1,6 +1,7 @@ from typing import List, Optional from sqlalchemy import create_engine, Engine, select from sqlalchemy.orm import Session, sessionmaker +from sqlalchemy import asc from Bartik.Assignments import Assignments from Bartik.AssignmentsProblemsMap import AssignmentsProblemsMap from Bartik.Courses import Courses @@ -55,7 +56,7 @@ def getScoreForAssignment(self, _email: str, _assessment: str, requiredProblems: if self.session is None: raise Exception("Session must be started") - assessmentIdStm = select(Assignments).where(Assignments.name.like(f"%{_assessment}%"), Assignments.course_id == self.COURSE_ID) + assessmentIdStm = select(Assignments).where(Assignments.name.like(f"%{_assessment}%"), Assignments.course_id == self.COURSE_ID).order_by(asc(Assignments.name)) assessmentIdAssessment = self.session.scalars(assessmentIdStm).first() if assessmentIdAssessment is None: