feat: disable idv on dashboard course listing (#29276)
There are messages on each course card on learner dashboard that displays action panels to prompt learners to do IDV. With honor code signature feature on, those panel message should be disabled Co-authored-by: Simon Chen <schen@edx-c02fw0guml85.lan>
This commit is contained in:
@@ -50,6 +50,7 @@ from lms.djangoapps.instructor import access
|
||||
from lms.djangoapps.verify_student.models import VerificationDeadline
|
||||
from lms.djangoapps.verify_student.services import IDVerificationService
|
||||
from lms.djangoapps.verify_student.utils import is_verification_expiring_soon, verification_for_datetime
|
||||
from openedx.core.djangoapps.agreements.toggles import is_integrity_signature_enabled
|
||||
from openedx.core.djangoapps.content.block_structure.exceptions import UsageKeyNotInBlockStructure
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.theming.helpers import get_themes
|
||||
@@ -116,6 +117,16 @@ def check_verify_status_by_course(user, course_enrollments):
|
||||
"""
|
||||
status_by_course = {}
|
||||
|
||||
# Before retriving verification data, if the integrity_signature feature is enabled for the course
|
||||
# let's bypass all logic below. Filter down to those course with integrity_signature not enabled.
|
||||
enabled_course_enrollments = []
|
||||
for enrollment in course_enrollments:
|
||||
if not is_integrity_signature_enabled(enrollment.course_id):
|
||||
enabled_course_enrollments.append(enrollment)
|
||||
|
||||
if len(enabled_course_enrollments) == 0:
|
||||
return status_by_course
|
||||
|
||||
# Retrieve all verifications for the user, sorted in descending
|
||||
# order by submission datetime
|
||||
verifications = IDVerificationService.verifications_for_user(user)
|
||||
@@ -133,7 +144,7 @@ def check_verify_status_by_course(user, course_enrollments):
|
||||
)
|
||||
recent_verification_datetime = None
|
||||
|
||||
for enrollment in course_enrollments:
|
||||
for enrollment in enabled_course_enrollments:
|
||||
|
||||
# If the user hasn't enrolled as verified, then the course
|
||||
# won't display state related to its verification status.
|
||||
|
||||
@@ -11,6 +11,7 @@ from django.conf import settings
|
||||
from django.test import override_settings
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import now
|
||||
from edx_toggles.toggles.testutils import override_waffle_flag
|
||||
from pytz import UTC
|
||||
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
@@ -27,6 +28,7 @@ from common.djangoapps.util.testing import UrlResetMixin
|
||||
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification, VerificationDeadline
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from openedx.core.djangoapps.agreements.toggles import ENABLE_INTEGRITY_SIGNATURE
|
||||
|
||||
|
||||
@patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True})
|
||||
@@ -318,6 +320,32 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
|
||||
self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"))
|
||||
self.assertContains(response2, attempt2.expiration_datetime.strftime("%m/%d/%Y"), count=2)
|
||||
|
||||
@override_waffle_flag(ENABLE_INTEGRITY_SIGNATURE, active=True)
|
||||
@ddt.data(
|
||||
None,
|
||||
'past',
|
||||
'future'
|
||||
)
|
||||
def test_verify_message_idv_disabled(self, deadline_key):
|
||||
if deadline_key:
|
||||
self._setup_mode_and_enrollment(self.DATES[deadline_key], "verified")
|
||||
else:
|
||||
self._setup_mode_and_enrollment(None, "verified")
|
||||
|
||||
self._assert_course_verification_status(None)
|
||||
|
||||
attempt = SoftwareSecurePhotoVerification.objects.create(user=self.user)
|
||||
self._assert_course_verification_status(None)
|
||||
attempt.mark_ready()
|
||||
self._assert_course_verification_status(None)
|
||||
attempt.submit()
|
||||
self._assert_course_verification_status(None)
|
||||
attempt.approve()
|
||||
self._assert_course_verification_status(None)
|
||||
attempt.expiration_date = self.DATES[self.PAST] - timedelta(days=900)
|
||||
attempt.save()
|
||||
self._assert_course_verification_status(None)
|
||||
|
||||
def _setup_mode_and_enrollment(self, deadline, enrollment_mode):
|
||||
"""Create a course mode and enrollment.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user