diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index aed7819..118842e 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -22,6 +22,9 @@ DISABLE_UNENROLL_CERT_STATES, ) from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_params +from openedx.core.djangoapps.appsembler.html_certificates.helpers import get_course_blocks_completion_summary +from openedx.core.djangoapps.content.block_structure.api import get_block_structure_manager +from lms.djangoapps.grades.api import CourseGradeFactory %> <% @@ -36,11 +39,40 @@ billing_email = settings.PAYMENT_SUPPORT_EMAIL is_course_expired = hasattr(show_courseware_link, 'error_code') and show_courseware_link.error_code == 'audit_expired' + + completion_summary = get_course_blocks_completion_summary(enrollment.course_id, user) + collected_block_structure = get_block_structure_manager(enrollment.course_id).get_collected() + course_grade = CourseGradeFactory().read(user, collected_block_structure=collected_block_structure) %> <%namespace name='static' file='../static_content.html'/>
  • +

    start examples

    +

    Certificates: Most of the certificates info you can find it on _dashboard_certificate_information.html, + is well documented there what to show depending on the status. In the folowing variable you can access to the same info.

    +

    ${cert_status}

    + +

    Completion info:

    +

    Here is the completion summary:

    +

    ${completion_summary}

    +

    You can calculate the percentage like this:

    +<% + if completion_summary['incomplete_count'] > 0: + completion_percent = 100 * float(completion_summary['complete_count'])/float(completion_summary['incomplete_count']) + else: + completion_percent = 0 +%> +

    ${completion_percent}%

    + +

    And finally the grade info:

    +

    ${course_grade}

    +

    you can access to it as an object

    +

    ${course_grade.percent}

    +

    ${course_grade.letter_grade}

    +

    ${course_grade.passed}

    + +

    end examples

    % if display_course_modes_on_dashboard: <% course_verified_certs = enrollment_mode_display( @@ -508,4 +540,4 @@

    ${_('Your current verification will expire soon.')} DateUtilFactory.transform(iterationKey=".localized-datetime"); - \ No newline at end of file +