Exemple #1
0
 def is_break_for_everyone(self, day: datetime.date,
                           school_year: Optional[SchoolYear]) -> bool:
     """Check if this is a break day for all students."""
     if school_year is None:
         return False
     return all(
         school_year.is_break(day, student=student)
         for student in Student.get_students_for(school_year))
Exemple #2
0
    def get_schedules(self, school_year, today, week):
        """Get the schedules for each student."""
        if school_year is None:
            return []

        return [
            student.get_week_schedule(school_year, today, week)
            for student in Student.get_students_for(school_year)
        ]
Exemple #3
0
    def get_schedules(self, school_year, today, day):
        """Get the schedules for each student."""
        schedules: list = []
        if not school_year or not school_year.runs_on(day) or school_year.is_break(day):
            return schedules

        for student in Student.get_students_for(school_year):
            schedule = self.get_student_schedule(student, today, day, school_year)
            schedules.append(schedule)

        return schedules
Exemple #4
0
    def get_schedules(self, school_year, today, week):
        """Get the schedules for each student."""
        schedules: list = []
        if school_year is None:
            return schedules

        for student in Student.get_students_for(school_year):
            schedule = student.get_week_schedule(school_year, today, week)
            schedules.append(schedule)

        return schedules
Exemple #5
0
    def get_schedules(self, school_year, today, week):
        """Get the schedules for each student."""
        if school_year is None:
            return []

        schedules = []
        for student in Student.get_students_for(school_year):
            schedule = student.get_week_schedule(school_year, today, week)
            schedule["week_dates"] = self.build_week_dates(
                school_year, week, student)
            schedules.append(schedule)

        return schedules
Exemple #6
0
    def get_schedules(self, school_year, today, day):
        """Get the schedules for each student."""
        schedules: list = []
        if not school_year:
            return schedules

        if not school_year.runs_on(day):
            return schedules

        for student in Student.get_students_for(school_year):
            courses = student.get_courses(school_year)
            schedule = self.get_student_schedule(student, today, day, courses)
            schedules.append(schedule)

        return schedules
Exemple #7
0
    def get_schedules(
        self,
        school_year,
        today: datetime.date,
        day: datetime.date,
        is_break_for_everyone,
    ):
        """Get the schedules for each student."""
        schedules: list = []
        if not school_year or not school_year.runs_on(
                day) or is_break_for_everyone:
            return schedules

        for student in Student.get_students_for(school_year):
            schedule = self.get_student_schedule(student, today, day,
                                                 school_year)
            schedules.append(schedule)

        return schedules