Commit d7941923 by zubair-arbi

Merge pull request #7774 from edx/zub/story/ecom-1437-reverification-lms-fixes

fix reverification link in lms
parents 0b66dc4b 05068f1b
""" """
Implement the Reverification XBlock "reverification" server Implement the Reverification XBlock "reverification" server
""" """
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -12,13 +13,13 @@ class ReverificationService(object): ...@@ -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 """ Check if the user has any verification attempt for this checkpoint and course_id
Args: Args:
user_id(str): User Id string user_id(str): User Id string
course_id(str): A string of course_id course_id(str): A string of course_id
checkpoint_name(str): Verification checkpoint name related_assessment(str): Verification checkpoint name
Returns: Returns:
Verification Status string if any attempt submitted by user else None Verification Status string if any attempt submitted by user else None
...@@ -28,29 +29,29 @@ class ReverificationService(object): ...@@ -28,29 +29,29 @@ class ReverificationService(object):
checkpoint_status = VerificationStatus.objects.filter( checkpoint_status = VerificationStatus.objects.filter(
user_id=user_id, user_id=user_id,
checkpoint__course_id=course_key, checkpoint__course_id=course_key,
checkpoint__checkpoint_name=checkpoint_name checkpoint__checkpoint_name=related_assessment
).latest() ).latest()
return checkpoint_status.status return checkpoint_status.status
except ObjectDoesNotExist: except ObjectDoesNotExist:
return None 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 """ Get or create the verification checkpoint and return the re-verification link
Args: Args:
course_id(str): A string of course_id course_id(str): A string of course_id
checkpoint_name(str): Verification checkpoint name related_assessment(str): Verification checkpoint name
Returns: Returns:
Re-verification link Re-verification link
""" """
course_key = CourseKey.from_string(course_id) 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( re_verification_link = reverse(
'verify_student_incourse_reverify', 'verify_student_incourse_reverify',
args=( args=(
unicode(course_key), unicode(course_key),
unicode(checkpoint_name), unicode(related_assessment),
unicode(item_id) unicode(item_id)
) )
) )
......
...@@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None ...@@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None
ECOMMERCE_API_TIMEOUT = 5 ECOMMERCE_API_TIMEOUT = 5
# Reverification checkpoint name pattern # Reverification checkpoint name pattern
CHECKPOINT_PATTERN = r'(?P<checkpoint_name>[\w ]+)' CHECKPOINT_PATTERN = r'(?P<checkpoint_name>[^/]+)'
# For the fields override feature # For the fields override feature
# If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add # If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add
......
...@@ -43,7 +43,7 @@ git+https://github.com/mitocw/django-cas.git@60a5b8e5a62e63e0d5d224a87f0b489201a ...@@ -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 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/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-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 # Third Party XBlocks
-e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga -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