Commit 05068f1b by zubair-arbi

fix reverification link in lms

ECOM-1437
parent 0b66dc4b
"""
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)
)
)
......
......@@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None
ECOMMERCE_API_TIMEOUT = 5
# Reverification checkpoint name pattern
CHECKPOINT_PATTERN = r'(?P<checkpoint_name>[\w ]+)'
CHECKPOINT_PATTERN = r'(?P<checkpoint_name>[^/]+)'
# For the fields override feature
# If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment