'Determine which course runs have been completed and failed by the user.
Returns:
dict with a list of completed and failed runs'

@cached_property
def course_runs_with_state(self):

    course_run_certificates = certificate_api.get_certificates_for_user(self.user.username)
    (completed_runs, failed_runs) = ([], [])
    for certificate in course_run_certificates:
        certificate_type = certificate['type']
        if (certificate_type == CourseMode.NO_ID_PROFESSIONAL_MODE):
            certificate_type = CourseMode.PROFESSIONAL
        course_data = {'course_run_id': unicode(certificate['course_key']), 'type': certificate_type}
        if certificate_api.is_passing_status(certificate['status']):
            completed_runs.append(course_data)
        else:
            failed_runs.append(course_data)
    return {'completed': completed_runs, 'failed': failed_runs}
