def get_context_data(self, **kwargs): context = super(EnrollmentDemographicsGenderView, self).get_context_data(**kwargs) presenter = CourseEnrollmentDemographicsPresenter(self.course_id) gender_data = None trend = None known_enrollment_percent = None last_updated = None try: last_updated, gender_data, trend, known_enrollment_percent = presenter.get_gender( ) except NotFoundError: logger.error( "Failed to retrieve enrollment demographic gender data for %s.", self.course_id) # add the enrollment data for the page context['js_data']['course']['genders'] = gender_data context['js_data']['course']['genderTrend'] = trend context.update({ 'update_message': self.get_last_updated_message(last_updated), 'chart_tooltip_value': self.format_percentage(known_enrollment_percent), 'data_information_message': self.data_information_message }) context['page_data'] = self.get_page_data(context) return context
def get_context_data(self, **kwargs): context = super(EnrollmentDemographicsEducationView, self).get_context_data(**kwargs) presenter = CourseEnrollmentDemographicsPresenter(self.course_id) binned_education = None summary = None known_enrollment_percent = None last_updated = None try: last_updated, summary, binned_education, known_enrollment_percent = presenter.get_education( ) except NotFoundError: logger.error( "Failed to retrieve enrollment demographic education data for %s.", self.course_id) # add the enrollment data for the page context['js_data']['course']['education'] = binned_education context.update({ 'summary': summary, 'chart_tooltip_value': self.format_percentage(known_enrollment_percent), 'update_message': self.get_last_updated_message(last_updated), 'data_information_message': self.data_information_message }) context['page_data'] = self.get_page_data(context) return context