Return credit status error if no provider info found.

Return credit status error if no provider info found in provider info by
id dict. Also add logs to get an idea what is in this dict.

LEARNER-6643
This commit is contained in:
Waheed Ahmed
2019-03-04 15:24:17 +05:00
parent 4a9a515419
commit dbad75467e
2 changed files with 8 additions and 2 deletions

View File

@@ -510,6 +510,14 @@ def _credit_statuses(user, course_enrollments):
status["provider_status_url"] = provider_info.get("status_url")
status["provider_id"] = provider_id
if not status["provider_name"] and not status["provider_status_url"]:
status["error"] = True
log.error(
u"Could not find credit provider info for [%s] in [%s]. The user will not "
u"be able to see his or her credit request status on the student dashboard.",
provider_id, provider_info_by_id
)
statuses[course_key] = status
return statuses

View File

@@ -184,8 +184,6 @@ class CreditProvider(TimeStampedModel):
]
cache.set(cls.CREDIT_PROVIDERS_CACHE_KEY, credit_providers)
else:
log.info(u"Found %d credit providers from cache.", len(credit_providers))
if providers_list:
credit_providers = [provider for provider in credit_providers if provider['id'] in providers_list]