Skip to content

Commit

Permalink
Fixed linting and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
el-agua committed Nov 2, 2023
1 parent 7e989ca commit d0e587d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/courses/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
import itertools
import json
import logging
import os
import random
Expand Down
2 changes: 1 addition & 1 deletion backend/plan/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from rest_framework_nested import routers

from plan.views import (
AutomaticCourseScheduler,
CalendarAPIView,
PrimaryScheduleViewSet,
ScheduleViewSet,
recommend_courses_view,
AutomaticCourseScheduler,
)


Expand Down
13 changes: 7 additions & 6 deletions backend/plan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
from rest_framework.views import APIView

from courses.models import Course, Meeting, Section
from courses.serializers import CourseListSerializer, CourseDetailSerializer, SectionDetailSerializer
from courses.util import get_course_and_section, get_current_semester, find_possible_schedules
from courses.serializers import (
CourseDetailSerializer,
CourseListSerializer,
SectionDetailSerializer,
)
from courses.util import find_possible_schedules, get_course_and_section, get_current_semester
from courses.views import get_accepted_friends
from PennCourses.docs_settings import PcxAutoSchema
from PennCourses.settings.base import PATH_REGISTRATION_SCHEDULE_NAME
Expand All @@ -30,10 +34,7 @@
vectorize_user_by_courses,
)
from plan.models import PrimarySchedule, Schedule
from plan.serializers import (
PrimaryScheduleSerializer,
ScheduleSerializer,
)
from plan.serializers import PrimaryScheduleSerializer, ScheduleSerializer


@api_view(["POST"])
Expand Down
23 changes: 23 additions & 0 deletions backend/tests/courses/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ def create_mock_data(code, semester, meeting_days="MWF", start=1100, end=1200):
return course, section


def create_mock_recitation(code, semester, meeting_days="MWF", start=1100, end=1200):
course, section, _, _ = get_or_create_course_and_section(code, semester)
course.description = "This is a fake class."
course.save()
section.credits = 0
section.status = "O"
section.activity = "REC"
section.save()
m = [
{
"building_code": "LLAB",
"room_code": "10",
"days": meeting_days,
"begin_time_24": start,
"begin_time": time_str(start),
"end_time_24": end,
"end_time": time_str(end),
}
]
set_meetings(section, m)
return course, section


def create_mock_data_with_reviews(code, semester, number_of_instructors):
course, section = create_mock_data(code, semester)
reviews = []
Expand Down

0 comments on commit d0e587d

Please sign in to comment.