Commit c03cd599 by Ayub khan Committed by GitHub

Merge pull request #15225 from edx/LEARNER-925

LEARNER-925 -Hot Fix Students unable to get certificates. 
parents 0d9146a2 761db165
...@@ -518,6 +518,23 @@ class TestProgramProgressMeter(TestCase): ...@@ -518,6 +518,23 @@ class TestProgramProgressMeter(TestCase):
meter = ProgramProgressMeter(self.user) meter = ProgramProgressMeter(self.user)
self.assertEqual(meter.completed_programs, [program['uuid']]) self.assertEqual(meter.completed_programs, [program['uuid']])
@mock.patch(UTILS_MODULE + '.ProgramProgressMeter.completed_course_runs', new_callable=mock.PropertyMock)
def test_credit_course_counted_complete_for_verified(self, mock_completed_course_runs, mock_get_programs):
"""
Verify that 'credit' course certificate type are treated as if they were
"verified" when checking for course completion status.
"""
course_run_key = generate_course_run_key()
course = CourseFactory(course_runs=[
CourseRunFactory(key=course_run_key, type='credit'),
])
program = ProgramFactory(courses=[course])
mock_get_programs.return_value = [program]
self._create_enrollments(course_run_key)
meter = ProgramProgressMeter(self.user)
mock_completed_course_runs.return_value = [{'course_run_id': course_run_key, 'type': 'verified'}]
self.assertEqual(meter._is_course_complete(course), True)
@ddt.ddt @ddt.ddt
@override_settings(ECOMMERCE_PUBLIC_URL_ROOT=ECOMMERCE_URL_ROOT) @override_settings(ECOMMERCE_PUBLIC_URL_ROOT=ECOMMERCE_URL_ROOT)
......
...@@ -266,7 +266,12 @@ class ProgramProgressMeter(object): ...@@ -266,7 +266,12 @@ class ProgramProgressMeter(object):
# count towards completion of a course in a program). This may change # count towards completion of a course in a program). This may change
# in the future to make use of the more rigid set of "applicable seat # in the future to make use of the more rigid set of "applicable seat
# types" associated with each program type in the catalog. # types" associated with each program type in the catalog.
'type': course_run['type'],
# Runs of type 'credit' are counted as 'verified' since verified
# certificates are earned when credit runs are completed. LEARNER-1274
# tracks a cleaner way to do this using the discovery service's
# applicable_seat_types field.
'type': 'verified' if course_run['type'] == 'credit' else course_run['type'],
} }
return any(reshape(course_run) in self.completed_course_runs for course_run in course['course_runs']) return any(reshape(course_run) in self.completed_course_runs for course_run in course['course_runs'])
......
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