diff --git a/cms/envs/common.py b/cms/envs/common.py index e7f3501594..4abea6ce13 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -451,7 +451,6 @@ INSTALLED_APPS = ( # for managing course modes 'course_modes', -<<<<<<< HEAD # Dark-launching languages 'dark_lang', diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index b8f14b13c8..692bc0aac8 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -84,6 +84,7 @@ log = logging.getLogger("edx.student") AUDIT_LOG = logging.getLogger("audit") Article = namedtuple('Article', 'title url author image deck publication publish_date') +ReverifyInfo = namedtuple('ReverifyInfo', 'course_id course_name course_number date status') def csrf_token(context): @@ -209,7 +210,7 @@ def reverification_info(course_enrollment_pairs, user, statuses): # Sort the data by the reverification_end_date for status in statuses: if reverifications[status]: - reverifications[status] = sorted(reverifications[status], key=lambda x: x[3]) + reverifications[status] = sorted(reverifications[status], key=lambda x: x.date) return reverifications @@ -217,7 +218,7 @@ def single_course_reverification_info(user, course, enrollment): """Returns midcourse reverification-related information for user with enrollment in course. If a course has an open re-verification window, and that user has a verified enrollment in - the course, we return a tuple with relevant information. Returns None if there is no info.. + the course, we return a tuple with relevant information. Returns None if there is no info.. Args: user (User): the user we want to get information for @@ -225,7 +226,7 @@ def single_course_reverification_info(user, course, enrollment): enrollment (CourseEnrollment): the object representing the type of enrollment user has in course Returns: - 5-tuple: (course_id, course_display_name, course_number, reverification_end_date, reverification_status) + 5-namedtuple: (course_id, course_name, course_number, date, status) OR, None: None if there is no re-verification info for this enrollment """ window = MidcourseReverificationWindow.get_window(course.id, datetime.datetime.now(UTC)) @@ -233,7 +234,7 @@ def single_course_reverification_info(user, course, enrollment): # If there's no window OR the user is not verified, we don't get reverification info if (not window) or (enrollment.mode != "verified"): return None - return ( + return ReverifyInfo( course.id, course.display_name, course.number, window.end_date.strftime('%B %d, %Y %X %p'), SoftwareSecurePhotoVerification.user_status(user, window)[0], diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 2981bc06a4..bb257f15a5 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -677,7 +677,7 @@ def fetch_reverify_banner_info(request, course_id): reverifications = defaultdict(list) user = request.user if not user.id: - return {'reverifications': None, } + return reverifications enrollment = CourseEnrollment.get_or_create_enrollment(request.user, course_id) course = course_from_id(course_id) info = single_course_reverification_info(user, course, enrollment) diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index f1b5b6bf53..c771144484 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -395,12 +395,12 @@ class MidCourseReverifyView(View): return render_to_response("verify_student/midcourse_photo_reverification.html", context) -def midcourse_reverify_dash(_request): +def midcourse_reverify_dash(request): """ Shows the "course reverification dashboard", which displays the reverification status (must reverify, pending, approved, failed, etc) of all courses in which a student has a verified enrollment. """ - user = _request.user + user = request.user course_enrollment_pairs = [] for enrollment in CourseEnrollment.enrollments_for_user(user): try: diff --git a/lms/templates/dashboard/_dashboard_prompt_midcourse_reverify.html b/lms/templates/dashboard/_dashboard_prompt_midcourse_reverify.html index 3714446377..c3cd7f87a8 100644 --- a/lms/templates/dashboard/_dashboard_prompt_midcourse_reverify.html +++ b/lms/templates/dashboard/_dashboard_prompt_midcourse_reverify.html @@ -8,10 +8,10 @@