From 05068f1b949bbb9f87860e4c718d25ff72c9f9b9 Mon Sep 17 00:00:00 2001 From: zubair-arbi Date: Thu, 23 Apr 2015 12:16:26 +0500 Subject: [PATCH] fix reverification link in lms ECOM-1437 --- lms/djangoapps/verify_student/services.py | 15 ++++++++------- lms/envs/common.py | 2 +- requirements/edx/github.txt | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lms/djangoapps/verify_student/services.py b/lms/djangoapps/verify_student/services.py index ab29d05107..83c2a641da 100644 --- a/lms/djangoapps/verify_student/services.py +++ b/lms/djangoapps/verify_student/services.py @@ -1,6 +1,7 @@ """ Implement the Reverification XBlock "reverification" server """ + from opaque_keys.edx.keys import CourseKey from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse @@ -12,13 +13,13 @@ class ReverificationService(object): """ - def get_status(self, user_id, course_id, checkpoint_name): + def get_status(self, user_id, course_id, related_assessment): """ Check if the user has any verification attempt for this checkpoint and course_id Args: user_id(str): User Id string course_id(str): A string of course_id - checkpoint_name(str): Verification checkpoint name + related_assessment(str): Verification checkpoint name Returns: Verification Status string if any attempt submitted by user else None @@ -28,29 +29,29 @@ class ReverificationService(object): checkpoint_status = VerificationStatus.objects.filter( user_id=user_id, checkpoint__course_id=course_key, - checkpoint__checkpoint_name=checkpoint_name + checkpoint__checkpoint_name=related_assessment ).latest() return checkpoint_status.status except ObjectDoesNotExist: return None - def start_verification(self, course_id, checkpoint_name, item_id): + def start_verification(self, course_id, related_assessment, item_id): """ Get or create the verification checkpoint and return the re-verification link Args: course_id(str): A string of course_id - checkpoint_name(str): Verification checkpoint name + related_assessment(str): Verification checkpoint name Returns: Re-verification link """ course_key = CourseKey.from_string(course_id) - VerificationCheckpoint.objects.get_or_create(course_id=course_key, checkpoint_name=checkpoint_name) + VerificationCheckpoint.objects.get_or_create(course_id=course_key, checkpoint_name=related_assessment) re_verification_link = reverse( 'verify_student_incourse_reverify', args=( unicode(course_key), - unicode(checkpoint_name), + unicode(related_assessment), unicode(item_id) ) ) diff --git a/lms/envs/common.py b/lms/envs/common.py index 1b72043016..9cf4766782 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None ECOMMERCE_API_TIMEOUT = 5 # Reverification checkpoint name pattern -CHECKPOINT_PATTERN = r'(?P[\w ]+)' +CHECKPOINT_PATTERN = r'(?P[^/]+)' # For the fields override feature # If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index 4356c9f624..77b17d0758 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -43,7 +43,7 @@ git+https://github.com/mitocw/django-cas.git@60a5b8e5a62e63e0d5d224a87f0b489201a git+https://github.com/edx/edx-lint.git@8bf82a32ecb8598c415413df66f5232ab8d974e9#egg=edx_lint==0.2.1 -e git+https://github.com/edx/xblock-utils.git@581ed636c862b286002bb9a3724cc883570eb54c#egg=xblock-utils -e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive --e git+https://github.com/edx/edx-reverification-block.git@1b7902db20bcefe7bd0109f866f830deaaf8d7f7#egg=edx-reverification-block +-e git+https://github.com/edx/edx-reverification-block.git@5da515ef229e73a137d366beb05ea4aea5881960#egg=edx-reverification-block # Third Party XBlocks -e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga