def certificate_info_for_user(user, course_id, grade, user_is_whitelisted=None):
 if (user_is_whitelisted is None):
  user_is_whitelisted = CertificateWhitelist.objects.filter(user=user, course_id=course_id, whitelist=True).exists()
 certificate_is_delivered = 'N'
 certificate_type = 'N/A'
 eligible_for_certificate = ('Y' if ((user_is_whitelisted or (grade is not None)) and user.profile.allow_certificate) else 'N')
 certificate_status = certificate_status_for_student(user, course_id)
 certificate_generated = (certificate_status['status'] == CertificateStatuses.downloadable)
 if certificate_generated:
  certificate_is_delivered = 'Y'
  certificate_type = certificate_status['mode']
 return [eligible_for_certificate, certificate_is_delivered, certificate_type]

def certificate_info_for_user ( user , course_id , grade , user_is_whitelisted = None ) : if ( user_is_whitelisted is None ) : user_is_whitelisted = CertificateWhitelist . objects . filter ( user = user , course_id = course_id , whitelist = True ) . exists ( ) certificate_is_delivered = 'N' certificate_type = 'N/A' eligible_for_certificate = ( 'Y' if ( ( user_is_whitelisted or ( grade is not None ) ) and user . profile . allow_certificate ) else 'N' ) certificate_status = certificate_status_for_student ( user , course_id ) certificate_generated = ( certificate_status [ 'status' ] == CertificateStatuses . downloadable ) if certificate_generated : certificate_is_delivered = 'Y' certificate_type = certificate_status [ 'mode' ] return [ eligible_for_certificate , certificate_is_delivered , certificate_type ]
returns the certificate info for a user for grade report .