Coverage for app/logic/manageSLFaculty.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-03-18 17:14 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-03-18 17:14 +0000
1from app.models.user import User
2from app.models.courseInstructor import CourseInstructor
3from app.models.course import Course
5def getInstructorCourses():
6 """
7 This function selects all the Instructors Name and the previous courses
8 """
9 instructors = (CourseInstructor.select(CourseInstructor, User, Course)
10 .join(User).switch()
11 .join(Course))
12 result = {}
14 for instructor in instructors:
15 result.setdefault(instructor.user, [])
16 if instructor.course.courseName not in result[instructor.user]:
17 result[instructor.user].append(instructor.course.courseName)
19 return result