Timetable App¶
The timetable app is the core application that has been a part of Semester.ly since our very first release. The timetable app does the heavy lifting for timetable generation, sharing, and viewing.
Models¶
- class timetable.models.Course(*args, **kwargs)[source]¶
Represents a course at a school, made unique by its course code. Courses persist across semesters and years. Their presence in a semester or year is indicated by the existence of sections assigned to that course for that semester or year. This is why a course does not have fields like professor, those varies.
The course model maintains only attributes which tend not to vary across semesters or years.
A course has many
Section
which a student can enroll in.- school¶
this course’s school’s code
- Type
CharField
- code¶
the course code without indication of section (e.g. EN.600.100)
- Type
CharField
- name¶
the general name of the course (E.g. Calculus I)
- Type
CharField
- description¶
the explanation of the content of the course
- Type
TextField
- notes¶
usually notes pertaining to registration (e.g. Lab Fees)
- Type
TextField
, optional
- info¶
similar to notes
- Type
TextField
, optional
- unstopped_description¶
automatically generated description without stopwords
- Type
TextField
- campus¶
an indicator for which campus the course is taught on
- Type
CharField
, optional
- prerequisites¶
courses required before taking this course
- Type
TextField
, optional
- corequisites¶
courses required concurrently with this course
- Type
TextField
, optional
- exclusions¶
reasons why a student would not be able to take this
- Type
TextField
, optional
- num_credits¶
the number of credit hours this course is worth
- Type
FloatField
- areas¶
list of all degree areas this course satisfies.
- Type
Arrayfield
- department¶
department offering course (e.g. Computer Science)
- Type
CharField
- level¶
indicator of level of course (e.g. 100, 200, Upper, Lower, Grad)
- Type
CharField
- cores¶
core areas satisfied by this course
- Type
CharField
- geneds¶
geneds satisfied by this course
- Type
CharField
courses computed similar to this course
- Type
ManyToManyField
ofCourse
, optional
- same_as¶
If this course is the same as another course, provide Foreign key
- Type
ForeignKey
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- get_avg_rating()[source]¶
Calculates the avg rating for a course, -1 if no ratings. Includes all courses that are marked as the same by the self.same_as field on the model instance.
- Returns
the average course rating
- Return type
(
float
)
- get_reactions(student=None)[source]¶
Return a list of dicts for each type of reaction (by title) for this course. Each dict has:
title: the title of the reaction
count: number of reactions with this title that this course has received
reacted: True if the student provided has given a reaction with this title
- class timetable.models.CourseIntegration(id, course, integration, json)[source]¶
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class timetable.models.Evaluation(*args, **kwargs)[source]¶
A review of a course represented as a score out of 5, a summary/comment, along with the professor and year the review is in subject of.
- score¶
score out of 5.0
- Type
FloatField
- summary¶
text with information about why the rating was given
- Type
TextField
- professor¶
the professor(s) this review pertains to
- Type
CharField
- year¶
the year of the review
- Type
CharField
- course_code¶
a string of the course code, along with section indicator
- Type
Charfield
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class timetable.models.Integration(id, name)[source]¶
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class timetable.models.Offering(*args, **kwargs)[source]¶
An Offering is the most granular part of the Course heirarchy. An offering may be looked at as the backend equivalent of a single slot on a timetable. For each day/time which a section meets, an offering is created.abs
- day¶
the day the course is offered (single character M,T,W,R,F,S,U)
- Type
CharField
- time_start¶
the time the slot starts in 24hrs time in the format (HH:MM) or (H:MM)
- Type
CharField
- time_end¶
the time it ends in 24hrs time in the format (HH:MM) or (H:MM)
- Type
CharField
- location¶
the location the course takes place, defaulting to TBA if not provided
- Type
CharField
, optional
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class timetable.models.Section(*args, **kwargs)[source]¶
Represents one (of possibly many) choice(s) for a student to enroll in a
Course
for a specific semester. Since this model is specific to a semester, it contains enrollment data, instructor information, etc.A section can come in different forms. For example, a lecture which is required for every student. However, it can also be a tutorial or practical. During timetable generation we allow a user to select one of each, and we can automatically choose the best combination for a user as well.
A section has many offerings related to it. For example, section 1 of a
Course
could have 3 offerings (one that meets each day: Monday, Wednesday, Friday). Section 2 of aCourse
could have 3 other offerings (one that meets each: Tuesday, Thursday).- meeting_section¶
the name of the section (e.g. 001, L01, LAB2)
- Type
CharField
- size¶
the capacity of the course (the enrollment cap)
- Type
IntegerField
- enrolment¶
the number of students registered so far
- Type
IntegerField
- waitlist¶
the number of students waitlisted so far
- Type
IntegerField
- waitlist_size¶
the max size of the waitlist
- Type
IntegerField
- section_type¶
the section type, example ‘L’ is lecture, ‘T’ is tutorial, P is practical
- Type
CharField
- instructors¶
comma seperated list of instructors
- Type
CharField
- was_full¶
whether the course was full during the last parse
- Type
BooleanField
- course_section_id¶
the id of the section when sending data to SIS
- Type
IntegerField
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class timetable.models.Semester(*args, **kwargs)[source]¶
Represents a semester which is composed of a name (e.g. Spring, Fall) and a year (e.g. 2017).
- name¶
the name (e.g. Spring, Fall)
- Type
CharField
- year¶
the year (e.g. 2017, 2018)
- Type
CharField
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
Views¶
- class timetable.views.TimetableLinkView(**kwargs)[source]¶
A subclass of
FeatureFlowView
(see Flows Documentation) for the viewing of shared timetable links. Provides the logic for preloading the shared timetable into initData when a user hits the corresponding url. The frontend can then act on this data to load the shared timetable for viewing.Additionally, on POST provides the functionality for the creation of shared timetables.
Serializers¶
Utils¶
- class timetable.utils.DisplayTimetable(slots, has_conflict, show_weekend, name='', events=None, id=None)[source]¶
Object that represents the frontend’s interpretation of a timetable.
- class timetable.utils.Slot(course, section, offerings, is_optional, is_locked)¶
- course¶
Alias for field number 0
- is_locked¶
Alias for field number 4
- is_optional¶
Alias for field number 3
- offerings¶
Alias for field number 2
- section¶
Alias for field number 1
- class timetable.utils.Timetable(courses, sections, has_conflict)¶
- courses¶
Alias for field number 0
- has_conflict¶
Alias for field number 2
- sections¶
Alias for field number 1
- timetable.utils.add_meeting_and_check_conflict(day_to_usage, new_meeting, school)[source]¶
Takes a @day_to_usage dictionary and a @new_meeting section and returns a tuple of the updated day_to_usage dict and a boolean which is True if conflict, False otherwise.
- timetable.utils.can_potentially_conflict(course_1_date_start, course_1_date_end, course_2_date_start, course_2_date_end)[source]¶
Checks two courses start & end dates to see whether they can overlap and hence potentially conflict. If any of the values are passed as None it will automatically consider that they can potentially conflict. Input type is string but has to be in a reasonable date format.
- Parameters
{[string]} -- [course 1 start date in a reasonable date format] (course_1_date_start) –
{[string]} -- [course 1 end date in a reasonable date format] (course_1_date_end) –
{[string]} -- [course 2 start date in a reasonable date format] (course_2_date_start) –
{[string]} -- [course 2 end date in a reasonable date format] (course_2_date_end) –
- Returns
[bool] – [True if if dates ranges of course 1 and 2 overlap, otherwise False]
- timetable.utils.courses_to_slots(courses, locked_sections, semester, optional_course_ids)[source]¶
Return a list of lists of Slots. Each Slot sublist represents the list of possibilities for a given course and section type, i.e. a valid timetable consists of any one slot from each sublist.
- timetable.utils.find_slots_to_fill(start, end, school)[source]¶
Take a @start and @end time in the format found in the coursefinder (e.g. 9:00, 16:30), and return the indices of the slots in thet array which represents times from 8:00am to 10pm that would be filled by the given @start and @end. For example, for uoft input: ‘10:30’, ‘13:00’ output: [5, 6, 7, 8, 9]
- timetable.utils.get_current_semesters(school)[source]¶
List of semesters ordered by academic temporality.
For a given school, get the possible semesters ordered by the most recent year for each semester that has course data, and return a list of (semester name, year) pairs.
- timetable.utils.get_day_to_usage(custom_events, school)[source]¶
Initialize day_to_usage dictionary, which has custom events blocked out.
- timetable.utils.get_hour_from_string_time(time_string)[source]¶
Get hour as an int from time as a string.
- timetable.utils.get_hours_minutes(time_string)[source]¶
Return tuple of two integers representing the hour and the time given a string representation of time. e.g. ‘14:20’ -> (14, 20)
- timetable.utils.get_minute_from_string_time(time_string)[source]¶
Get minute as an int from time as a string.
- timetable.utils.get_time_index(hours, minutes, school)[source]¶
Take number of hours and minutes, and return the corresponding time slot index
- timetable.utils.get_xproduct_indicies(lists)[source]¶
Takes a list of lists and returns two lists of indicies needed to iterate through the cross product of the input.