def _upload_surveys_questions_ratings(self): start_time = time.time() survey_answer_dtos = self.rails_dtos["survey_answer"].values() for i, survey_answer_dto in enumerate(survey_answer_dtos): if self.i > i: continue self.i = i instructorship_dto = self.rails_dtos["instructorship"][ survey_answer_dto.instructorship_id] survey_question_dto = self.rails_dtos["survey_question"][ survey_answer_dto.survey_question_id] icsr = self.r2d["icsr"][instructorship_dto.id] survey = DJANGO.Survey(survey_answer_dto, instructorship_dto, icsr) survey.upload(WEBSITE_BASE_URL, AUTHENTICATION) question = self._get_or_upload_question(survey_question_dto) rating = DJANGO.Rating( survey_answer_dto, survey_question_dto, survey, question, ) rating.upload(WEBSITE_BASE_URL, AUTHENTICATION) print_update(i, len(survey_answer_dtos), start_time) print()
def _get_or_upload_question(self, survey_question_dto): if survey_question_dto.id in self.r2d["question"]: return self.r2d["question"][survey_question_dto.id] question = DJANGO.Question() question.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["question"][survey_question_dto.id] = question return question
def _get_or_upload_course(self, course_dto): if course_dto.id in self.r2d["course"]: return self.r2d["course"][course_dto.id] course = DJANGO.Course() course.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["course"][course_dto.id] = course return course
def _upload_departments(self): department_dtos = self.rails_dtos["department"].values() for i, department_dto in enumerate(department_dtos): if self.i > i: continue self.i = i department = DJANGO.Department(department_dto) department.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["department"][department_dto.id] = department
def _upload_semesters(self): klass_dtos = self.rails_dtos["klass"].values() for i, klass_dto in enumerate(klass_dtos): if self.i > i: continue self.i = i if klass_dto.semester in self.r2d["semester"]: continue semester = DJANGO.Semester(klass_dto) semester.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["semester"][klass_dto.semester] = semester
def _upload_instructors(self): start_time = time.time() instructor_dtos = self.rails_dtos["instructor"].values() for i, instructor_dto in enumerate(instructor_dtos): if self.i > i: continue self.i = i instructor = DJANGO.Instructor(instructor_dto) instructor.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["instructor"][instructor_dto.id] = instructor print_update(i, len(instructor_dtos), start_time) print()
def _upload_icsrs_courses(self): start_time = time.time() instructorship_dtos = self.rails_dtos["instructorship"].values() for i, instructorship_dto in enumerate(instructorship_dtos): if self.i > i: continue self.i = i klass_dto = self.rails_dtos["klass"][instructorship_dto.klass_id] instructor_dto = self.rails_dtos["instructor"][ instructorship_dto.instructor_id] course_dto = self.rails_dtos["course"][klass_dto.course_id] course = self._get_or_upload_course(course_dto) department = self.r2d["department"][course_dto.dept_id] instructor = self.r2d["instructor"][instructor_dto.id] semester = self.r2d["semester"][klass_dto.semester] icsr = DJANGO.ICSR( instructor_dto, course_dto, instructorship_dto, klass_dto, course, department, instructor, semester, ) icsr.upload(WEBSITE_BASE_URL, AUTHENTICATION) self.r2d["icsr"][instructorship_dto.id] = icsr print_update(i, len(instructorship_dtos), start_time) print()