Example #1
0
 def _get_language(self):
     """
     Get list of available languages
     :return: 
     """
     languages_list = self._get_options_by_select_id('languageId')
     language_obj = AHAField(type=AHAField.FIELD_TYPES.LANGUAGE,
                             value=languages_list,
                             user=self.user)
     logging.info("Languages: {}".format(language_obj.value))
     self.group_data.append(language_obj)
Example #2
0
 def _get_course(self):
     """
     Get list of available courses
     :return: 
     """
     courses_list = self._get_options_by_select_id('courseId')
     course_obj = AHAField(type=AHAField.FIELD_TYPES.COURSE,
                           value=courses_list,
                           user=self.user)
     logging.info("Courses: {}".format(course_obj.value))
     self.group_data.append(course_obj)
Example #3
0
    def _save_to_db(self):
        """
        Save received values to database
        :return: 
        """
        logging.info("Finish AHA Importing, saving")
        AHAField.objects.filter(user=self.user).delete()

        description_field = AHAField(
            type=AHAField.FIELD_TYPES.CLASS_DESCRIPTION,
            value=[],
            user=self.user)
        notes_field = AHAField(type=AHAField.FIELD_TYPES.CLASS_NOTES,
                               value=[],
                               user=self.user)

        other_fields = [description_field, notes_field]
        self.group_data.extend(other_fields)

        AHAField.objects.bulk_create(self.group_data)
Example #4
0
 def _get_instructors(self):
     """
     Get list of available instructors
     :return: 
     """
     instructor_list = self._get_options_by_select_id('instructorId')
     instructor_obj = AHAField(type=AHAField.FIELD_TYPES.INSTRUCTOR,
                               value=instructor_list,
                               user=self.user)
     logging.info("Instructors: {}".format(len(instructor_list)))
     self.group_data.append(instructor_obj)
Example #5
0
 def _get_location(self):
     """
     Get list of available locations
     :return: 
     """
     locations_list = self._get_options_by_select_id('locationId',
                                                     remove_first=True)
     location_obj = AHAField(type=AHAField.FIELD_TYPES.LOCATION,
                             value=locations_list,
                             user=self.user)
     logging.info("Locations: {}".format(location_obj.value))
     self.group_data.append(location_obj)
Example #6
0
 def _get_ts(self):
     """
     Get list of available training sites
     :return: 
     """
     self._click_on_first_option(select_id='tcId')
     WebDriverWait(self.browser, 5).until(
         EC.presence_of_element_located((By.ID, 'tsNames')))
     ts_list = self._get_options_by_select_id('tcSiteId')
     ts_obj = AHAField(type=AHAField.FIELD_TYPES.TS,
                       value=ts_list,
                       user=self.user)
     logging.info("Training Sites: {}".format(ts_obj.value))
     self.group_data.append(ts_obj)