def _section_course_info(course, access): """ Provide data for the corresponding dashboard section """ course_key = course.id section_data = { 'section_key': 'course_info', 'section_display_name': _('Course Info'), 'access': access, 'course_id': course_key, 'course_display_name': course.display_name, 'enrollment_count': CourseEnrollment.enrollment_counts(course_key), 'has_started': course.has_started(), 'has_ended': course.has_ended(), 'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_key.to_deprecated_string()}), } try: advance = lambda memo, (letter, score): "{}: {}, ".format(letter, score) + memo section_data['grade_cutoffs'] = reduce(advance, course.grade_cutoffs.items(), "")[:-2] except Exception: section_data['grade_cutoffs'] = "Not Available" # section_data['offline_grades'] = offline_grades_available(course_key) try: section_data['course_errors'] = [(escape(a), '') for (a, _unused) in modulestore().get_course_errors(course.id)] except Exception: section_data['course_errors'] = [('Error fetching errors', '')] return section_data
def _section_course_info(course, access): """ Provide data for the corresponding dashboard section """ course_key = course.id section_data = { 'section_key': 'course_info', 'section_display_name': _('Course Info'), 'access': access, 'course_id': course_key, 'course_display_name': course.display_name, 'has_started': course.has_started(), 'has_ended': course.has_ended(), 'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': unicode(course_key)}), } if settings.FEATURES.get('DISPLAY_ANALYTICS_ENROLLMENTS'): section_data['enrollment_count'] = CourseEnrollment.enrollment_counts( course_key) if settings.ANALYTICS_DASHBOARD_URL: dashboard_link = _get_dashboard_link(course_key) message = _("Enrollment data is now available in {dashboard_link}." ).format(dashboard_link=dashboard_link) section_data['enrollment_message'] = message if settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'): section_data['detailed_gitlogs_url'] = reverse( 'gitlogs_detail', kwargs={'course_id': unicode(course_key)}) try: advance = lambda memo, (letter, score): "{}: {}, ".format( letter, score) + memo section_data['grade_cutoffs'] = reduce(advance, course.grade_cutoffs.items(), "")[:-2] except Exception: # pylint: disable=broad-except section_data['grade_cutoffs'] = "Not Available" # section_data['offline_grades'] = offline_grades_available(course_key) try: section_data['course_errors'] = [ (escape(a), '') for (a, _unused) in modulestore().get_course_errors(course.id) ] except Exception: # pylint: disable=broad-except section_data['course_errors'] = [('Error fetching errors', '')] return section_data
def rows(self): for course_id in course_ids_between(self.start_word, self.end_word): # If the first letter of the university is between start_word and end_word, then we include # it in the report. These comparisons are unicode-safe. cur_course = get_course_by_id(course_id) university = cur_course.org course = cur_course.number + " " + cur_course.display_name_with_default # TODO add term (i.e. Fall 2013)? counts = CourseEnrollment.enrollment_counts(course_id) total_enrolled = counts['total'] audit_enrolled = counts['audit'] honor_enrolled = counts['honor'] if counts['verified'] == 0: verified_enrolled = 0 gross_rev = Decimal(0.00) gross_rev_over_min = Decimal(0.00) else: verified_enrolled = counts['verified'] gross_rev = CertificateItem.verified_certificates_monetary_field_sum(course_id, 'purchased', 'unit_cost') gross_rev_over_min = gross_rev - (CourseMode.min_course_price_for_verified_for_currency(course_id, 'usd') * verified_enrolled) num_verified_over_the_minimum = CertificateItem.verified_certificates_contributing_more_than_minimum(course_id) # should I be worried about is_active here? number_of_refunds = CertificateItem.verified_certificates_count(course_id, 'refunded') if number_of_refunds == 0: dollars_refunded = Decimal(0.00) else: dollars_refunded = CertificateItem.verified_certificates_monetary_field_sum(course_id, 'refunded', 'unit_cost') course_announce_date = "" course_reg_start_date = "" course_reg_close_date = "" registration_period = "" yield [ university, course, course_announce_date, course_reg_start_date, course_reg_close_date, registration_period, total_enrolled, audit_enrolled, honor_enrolled, verified_enrolled, gross_rev, gross_rev_over_min, num_verified_over_the_minimum, number_of_refunds, dollars_refunded ]
def _section_course_info(course, access): """ Provide data for the corresponding dashboard section """ course_key = course.id section_data = { 'section_key': 'course_info', 'section_display_name': _('Course Info'), 'access': access, 'course_id': course_key, 'course_display_name': course.display_name, 'has_started': course.has_started(), 'has_ended': course.has_ended(), 'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': unicode(course_key)}), } if settings.FEATURES.get('DISPLAY_ANALYTICS_ENROLLMENTS'): section_data['enrollment_count'] = CourseEnrollment.enrollment_counts(course_key) if settings.ANALYTICS_DASHBOARD_URL: dashboard_link = _get_dashboard_link(course_key) message = _("Enrollment data is now available in {dashboard_link}.").format(dashboard_link=dashboard_link) section_data['enrollment_message'] = message if settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'): section_data['detailed_gitlogs_url'] = reverse('gitlogs_detail', kwargs={'course_id': unicode(course_key)}) try: advance = lambda memo, (letter, score): "{}: {}, ".format(letter, score) + memo section_data['grade_cutoffs'] = reduce(advance, course.grade_cutoffs.items(), "")[:-2] except Exception: # pylint: disable=broad-except section_data['grade_cutoffs'] = "Not Available" # section_data['offline_grades'] = offline_grades_available(course_key) try: section_data['course_errors'] = [(escape(a), '') for (a, _unused) in modulestore().get_course_errors(course.id)] except Exception: # pylint: disable=broad-except section_data['course_errors'] = [('Error fetching errors', '')] return section_data
def _section_course_info(course, access): """ Provide data for the corresponding dashboard section """ course_key = course.id section_data = { "section_key": "course_info", "section_display_name": _("Course Info"), "access": access, "course_id": course_key, "course_display_name": course.display_name, "has_started": course.has_started(), "has_ended": course.has_ended(), "list_instructor_tasks_url": reverse( "list_instructor_tasks", kwargs={"course_id": course_key.to_deprecated_string()} ), } if settings.FEATURES.get("DISPLAY_ANALYTICS_ENROLLMENTS"): section_data["enrollment_count"] = CourseEnrollment.enrollment_counts(course_key) if settings.ANALYTICS_DASHBOARD_URL: dashboard_link = _get_dashboard_link(course_key) message = _("Enrollment data is now available in {dashboard_link}.").format(dashboard_link=dashboard_link) section_data["enrollment_message"] = message try: advance = lambda memo, (letter, score): "{}: {}, ".format(letter, score) + memo section_data["grade_cutoffs"] = reduce(advance, course.grade_cutoffs.items(), "")[:-2] except Exception: # pylint: disable=broad-except section_data["grade_cutoffs"] = "Not Available" # section_data['offline_grades'] = offline_grades_available(course_key) try: section_data["course_errors"] = [(escape(a), "") for (a, _unused) in modulestore().get_course_errors(course.id)] except Exception: # pylint: disable=broad-except section_data["course_errors"] = [("Error fetching errors", "")] return section_data