diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 76b3c8e1a52..511a03192dd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,11 @@ Change Log Unreleased ~~~~~~~~~~ +[3.17.0] - 2021-06-23 +~~~~~~~~~~~~~~~~~~~~~ +* Replace internal logic for determing learners' onboarding statuses for the course onboarding API + with provider onboarding API. + [3.16.0] - 2021-06-22 ~~~~~~~~~~~~~~~~~~~~~ * Created a GET api endpoint which groups course allowances by users. diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index 392c2c7e1fe..9fcb15208a7 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -3,6 +3,6 @@ """ # Be sure to update the version number in edx_proctoring/package.json -__version__ = '3.16.0' +__version__ = '3.17.0' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/constants.py b/edx_proctoring/constants.py index e754e4d76df..3396b2d9c8e 100644 --- a/edx_proctoring/constants.py +++ b/edx_proctoring/constants.py @@ -70,6 +70,8 @@ ONBOARDING_PROFILE_API = 'edx_proctoring.onboarding_profile_api' +ONBOARDING_PROFILE_INSTRUCTOR_DASHBOARD_API = 'edx_proctoring.onboarding_profile_instructor_dashboard_api' + CONTENT_VIEWABLE_PAST_DUE_DATE = getattr(settings, 'PROCTORED_EXAM_VIEWABLE_PAST_DUE', False) TIME_MULTIPLIER = 'time_multiplier' diff --git a/edx_proctoring/static/proctoring/js/views/proctored_exam_onboarding_view.js b/edx_proctoring/static/proctoring/js/views/proctored_exam_onboarding_view.js index 46e62d24815..2d043f0debc 100644 --- a/edx_proctoring/static/proctoring/js/views/proctored_exam_onboarding_view.js +++ b/edx_proctoring/static/proctoring/js/views/proctored_exam_onboarding_view.js @@ -3,7 +3,7 @@ edx = edx || {}; (function(Backbone, $, _, gettext) { 'use strict'; - var viewHelper, onboardingStatuses, statusAndModeReadableFormat; + var viewHelper, onboardingStatuses, onboardingProfileAPIStatuses, statusAndModeReadableFormat; edx.instructor_dashboard = edx.instructor_dashboard || {}; edx.instructor_dashboard.proctoring = edx.instructor_dashboard.proctoring || {}; onboardingStatuses = [ @@ -16,6 +16,14 @@ edx = edx || {}; 'rejected', 'error' ]; + onboardingProfileAPIStatuses = [ + 'not_started', + 'other_course_approved', + 'submitted', + 'verified', + 'rejected', + 'expired' + ]; statusAndModeReadableFormat = { // Onboarding statuses not_started: gettext('Not Started'), @@ -27,6 +35,7 @@ edx = edx || {}; verified: gettext('Verified'), rejected: gettext('Rejected'), error: gettext('Error'), + expired: gettext('Expired'), // TODO: remove as part of MST-745 onboarding_reset_past_due: gettext('Onboarding Reset Failed Due to Past Due Exam'), // Enrollment modes (Note: 'verified' is both a status and enrollment mode) @@ -186,11 +195,21 @@ edx = edx || {}; $searchIcon = $(document.getElementById('onboarding-search-indicator')); $searchIcon.removeClass('hidden'); }, - error: function() { + error: function(unused, response) { + var data, $searchIcon, $spinner, $errorResponse, $onboardingPanel; + // in the case that there is no onboarding data, we // still want the view to render - var $searchIcon, $spinner; self.render(); + + data = $.parseJSON(response.responseText); + if (data.detail) { + $errorResponse = $('#error-response'); + $errorResponse.html(data.detail); + $onboardingPanel = $('.onboarding-status-content'); + $onboardingPanel.hide(); + } + $spinner = $(document.getElementById('onboarding-loading-indicator')); $spinner.addClass('hidden'); $searchIcon = $(document.getElementById('onboarding-search-indicator')); @@ -202,7 +221,8 @@ edx = edx || {}; this.hydrate(); }, render: function() { - var data, dataJson, html, startPage, endPage; + var data, dataJson, html, startPage, endPage, statuses; + if (this.template !== null) { data = { previousPage: null, @@ -234,12 +254,13 @@ edx = edx || {}; endPage = dataJson.num_pages; } + statuses = dataJson.use_onboarding_profile_api ? onboardingProfileAPIStatuses : onboardingStatuses; data = { previousPage: dataJson.previous, nextPage: dataJson.next, currentPage: this.currentPage, onboardingItems: dataJson.results, - onboardingStatuses: onboardingStatuses, + onboardingStatuses: statuses, inSearchMode: this.inSearchMode, searchText: this.searchText, filters: this.filters, diff --git a/edx_proctoring/static/proctoring/spec/proctored_exam_onboarding_spec.js b/edx_proctoring/static/proctoring/spec/proctored_exam_onboarding_spec.js index 32ae5e486d7..d91f83337e5 100644 --- a/edx_proctoring/static/proctoring/spec/proctored_exam_onboarding_spec.js +++ b/edx_proctoring/static/proctoring/spec/proctored_exam_onboarding_spec.js @@ -7,6 +7,7 @@ describe('ProctoredExamOnboardingView', function() { previous: null, next: null, num_pages: 1, + use_onboarding_profile_api: false, results: [ { username: 'testuser1', @@ -40,11 +41,13 @@ describe('ProctoredExamOnboardingView', function() { previous: null, next: null, num_pages: 1, - results: [] + results: [], + use_onboarding_profile_api: false }]; beforeEach(function() { html = '