Commit fd318e05 by Douglas Hall

Merge pull request #11767 from edx/ibrahimahmed443/SOL-1691

return course end date in credit service and rename flag
parents 2c3b728c 97ef7397
......@@ -48,7 +48,7 @@ class CreditService(object):
return is_credit_course(course_key)
def get_credit_state(self, user_id, course_key_or_id, return_course_name=False):
def get_credit_state(self, user_id, course_key_or_id, return_course_info=False):
"""
Return all information about the user's credit state inside of a given
course.
......@@ -66,6 +66,7 @@ class CreditService(object):
'is_credit_course': if the course has been marked as a credit bearing course
'credit_requirement_status': the user's status in fulfilling those requirements
'course_name': optional display name of the course
'course_end_date': optional end date of the course
}
"""
......@@ -99,10 +100,11 @@ class CreditService(object):
'credit_requirement_status': get_credit_requirement_status(course_key, user.username)
}
if return_course_name:
if return_course_info:
course = modulestore().get_course(course_key, depth=0)
result.update({
'course_name': course.display_name,
'course_end_date': course.end,
})
return result
......
......@@ -253,7 +253,7 @@ class CreditServiceTests(ModuleStoreTestCase):
self.assertNotIn('course_name', credit_state)
# now make sure it is in there when we pass in the flag
credit_state = self.service.get_credit_state(self.user.id, self.course.id, return_course_name=True)
credit_state = self.service.get_credit_state(self.user.id, self.course.id, return_course_info=True)
self.assertIn('course_name', credit_state)
self.assertEqual(credit_state['course_name'], self.course.display_name)
......
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