Coverage for app/logic/manageSLFaculty.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2024-03-01 16:17 +0000

1from app.models.user import User 

2from app.models.courseInstructor import CourseInstructor 

3from app.models.course import Course 

4 

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 = {} 

13 

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) 

18 

19 return result