def decode_course(self, course_dict):
        cr_json = course_dict.get('course_runs')
        course_runs = self.decode_course_runs(cr_json)
        dep_json = course_dict.get('department')
        department = self.decode_department(dep_json)
        evaluation_json = course_dict.get('evaluations')
        evaluations =  self.decode_evaluations(evaluation_json)

        course = Course(
            code = course_dict['code'],
            language = course_dict['language'],
            title_en = course_dict['title_en'],
            title_da = course_dict['title_da'],
            evaluation_type = course_dict['evaluation_type'],
            ects_credits = float(course_dict['ects_credits'].replace(",", ".")),
            course_type = course_dict['course_type'],
            department = department
        )
        for run in course_runs:
            course.add_course_run(run)

        for evaluation in evaluations:
            course.add_evaluation(evaluation)

        return course
Ejemplo n.º 2
0
    def decode_course(self, course_dict):
        cr_json = course_dict.get("course_runs")
        course_runs = self.decode_course_runs(cr_json)
        dep_json = course_dict.get("department")
        department = self.decode_department(dep_json)

        course = Course(
            code=course_dict["code"],
            language=course_dict["language"],
            title_en=course_dict["title_en"],
            title_da=course_dict["title_da"],
            evaluation_type=course_dict["evaluation_type"],
            ects_credits=course_dict["ects_credits"],
            course_type=course_dict["course_type"],
            department=department,
        )
        for run in course_runs:
            course.add_course_run(run)

        return course