Pass program UUID as resource_id to generate unique cache key.

Without program UUID cache key was same every time for single learner
on multiple programs and getting the same data from cache.

LEARNER-5373
This commit is contained in:
Waheed Ahmed
2018-05-30 15:04:15 +05:00
parent 90633c0956
commit e7963a5b40
3 changed files with 8 additions and 2 deletions

View File

@@ -312,7 +312,6 @@
.program-heading-message {
font-weight: 300;
}
}
.course-enroll-view {

View File

@@ -46,6 +46,7 @@ class TestGetCredentials(CredentialsApiConfigMixin, CacheIsolationTestCase):
'status': 'awarded',
}
self.assertEqual(kwargs['querystring'], querystring)
self.assertIsNone(kwargs['resource_id'])
self.assertEqual(actual, expected)
@@ -66,5 +67,6 @@ class TestGetCredentials(CredentialsApiConfigMixin, CacheIsolationTestCase):
'program_uuid': program_uuid,
}
self.assertEqual(kwargs['querystring'], querystring)
self.assertEqual(kwargs['resource_id'], program_uuid)
self.assertEqual(actual, expected)

View File

@@ -59,5 +59,10 @@ def get_credentials(user, program_uuid=None):
api = get_credentials_api_client(user)
return get_edx_api_data(
credential_configuration, 'credentials', api=api, querystring=querystring, cache_key=cache_key
credential_configuration,
'credentials',
api=api,
resource_id=program_uuid,
querystring=querystring,
cache_key=cache_key
)