Example #1
0
def set_semester():
    post_save.disconnect(
        receiver=invalidate_current_semester_cache,
        sender=Option,
        dispatch_uid="invalidate_current_semester_cache",
    )
    Option(key="SEMESTER", value=TEST_SEMESTER, value_type="TXT").save()
    AddDropPeriod(semester=TEST_SEMESTER).save()
Example #2
0
    def setUp(self):
        set_semester()
        AddDropPeriod(semester="2017A").save()
        AddDropPeriod(semester="2012A").save()
        AddDropPeriod(semester="2012C").save()
        self.instructor_name = "Instructor One"
        self.client = APIClient()
        self.client.force_login(User.objects.create_user(username="******"))
        create_review("CIS-471-001", TEST_SEMESTER, self.instructor_name,
                      {"instructor_quality": 4})
        create_review("CIS-471-001", "2017A", "Instructor Two",
                      {"instructor_quality": 2})

        create_review("CIS-371-900", "2012A", self.instructor_name,
                      {"instructor_quality": 2})
        create_review("CIS-371-003", "2012C", "Instructor Two",
                      {"instructor_quality": 1})

        Section.objects.all().update(activity="LEC")

        self.instructor1 = Instructor.objects.get(name=self.instructor_name)
        self.instructor1_pk = self.instructor1.pk
        self.instructor2 = Instructor.objects.get(name="Instructor Two")
        self.instructor2_pk = self.instructor2.pk

        topic_371 = Topic.objects.get(most_recent__full_code="CIS-371")
        topic_471 = Topic.objects.get(most_recent__full_code="CIS-471")
        topic_371.merge_with(topic_471)

        self.extra_course_data = {
            "code":
            "CIS-471",
            "historical_codes": [{
                "full_code": "CIS-371",
                "branched_from": False,
                "semester": "2012C"
            }],
        }
def fill_in_add_drop_periods(verbose=False):
    all_semesters = set(
        Course.objects.values_list("semester", flat=True).distinct())
    adp_semesters = set(
        AddDropPeriod.objects.values_list("semester", flat=True).distinct())
    missing_semesters = set()
    for candidate in all_semesters - adp_semesters:
        try:
            validate_add_drop_semester(candidate)
            missing_semesters.add(candidate)
        except ValidationError:
            pass
    if verbose and len(missing_semesters) > 0:
        print(
            f"Filling in AddDropPeriod objects for semesters {missing_semesters}"
        )
    for semester in missing_semesters:
        AddDropPeriod(semester=semester).save()
    return adp_semesters.union(missing_semesters)
Example #4
0
    def setUp(self):
        set_semester()
        AddDropPeriod(semester="2012A").save()
        self.instructor_name = "Instructor One"
        self.client = APIClient()
        self.client.force_login(User.objects.create_user(username="******"))
        create_review("ARTH-2220-001", TEST_SEMESTER, self.instructor_name,
                      {"instructor_quality": 4})
        create_review("NELC-2055-001", TEST_SEMESTER, self.instructor_name,
                      {"instructor_quality": 3})
        create_review("ARTH-222-001", "2012A", self.instructor_name,
                      {"instructor_quality": 2})
        topic_2220 = Topic.objects.get(most_recent__full_code="ARTH-2220")
        topic_2055 = Topic.objects.get(most_recent__full_code="NELC-2055")
        topic_222 = Topic.objects.get(most_recent__full_code="ARTH-222")
        topic_2220.branched_from = topic_222
        topic_2220.save()
        topic_2055.branched_from = topic_222
        topic_2055.save()

        self.extra_course_data_2220 = {
            "code":
            "ARTH-2220",
            "historical_codes": [{
                "full_code": "ARTH-222",
                "branched_from": True,
                "semester": "2012A"
            }],
        }
        self.extra_course_data_2055 = {
            "code":
            "NELC-2055",
            "historical_codes": [{
                "full_code": "ARTH-222",
                "branched_from": True,
                "semester": "2012A"
            }],
        }
        self.extra_course_data_222 = {
            "code": "ARTH-222",
            "historical_codes": [],
        }
Example #5
0
    def setUp(self):
        set_semester()
        AddDropPeriod(semester="2012A").save()
        self.instructor_name = "Instructor One"
        self.client = APIClient()
        self.client.force_login(User.objects.create_user(username="******"))

        _, section = create_mock_data("CIS-471-001", TEST_SEMESTER)
        instructor, _ = Instructor.objects.get_or_create(
            name=self.instructor_name)
        section.instructors.add(instructor)

        create_review("CIS-371-001", "2012A", self.instructor_name,
                      {"instructor_quality": 2})
        create_review(
            "CIS-371-002",
            "2007C",
            self.instructor_name,
            {"instructor_quality": 0},
            responses=0,
        )
        create_review(
            "CIS-471-001",
            "2007C",
            "No Responses Instructor",
            {"instructor_quality": 0},
            responses=0,
        )
        Section.objects.all().update(activity="LEC")
        topic_371 = Topic.objects.get(most_recent__full_code="CIS-371")
        topic_471 = Topic.objects.get(most_recent__full_code="CIS-471")
        topic_371.merge_with(topic_471)

        self.extra_course_data = {
            "code":
            "CIS-471",
            "historical_codes": [{
                "full_code": "CIS-371",
                "branched_from": False,
                "semester": "2012A"
            }],
        }
Example #6
0
 def setUp(self):
     set_semester()
     AddDropPeriod(semester="2012A").save()
     self.instructor_name = "Instructor One"
     self.client = APIClient()
     self.client.force_login(User.objects.create_user(username="******"))
     create_review("CIS-120-001", TEST_SEMESTER, self.instructor_name,
                   {"instructor_quality": 4})
     create_review("CIS-120-001", "2012A", self.instructor_name,
                   {"instructor_quality": 2})
     create_review(
         "CIS-120-002",
         "2007C",
         self.instructor_name,
         {"instructor_quality": 0},
         responses=0,
     )
     create_review(
         "CIS-120-001",
         "2007C",
         "No Responses Instructor",
         {"instructor_quality": 0},
         responses=0,
     )