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