def export(self):
<EOL>enrollment_queryset = EnterpriseCourseEnrollment.objects.select_related(<EOL>'<STR_LIT>'<EOL>).filter(<EOL>enterprise_customer_user__enterprise_customer=self.enterprise_customer,<EOL>enterprise_customer_user__active=True,<EOL>).order_by('<STR_LIT>')<EOL>course_details = None<EOL>for enterprise_enrollment in enrollment_queryset:<EOL><INDENT>course_id = enterprise_enrollment.course_id<EOL>if course_details is None or course_details['<STR_LIT>'] != course_id:<EOL><INDENT>if self.course_api is None:<EOL><INDENT>self.course_api = CourseApiClient()<EOL><DEDENT>course_details = self.course_api.get_course_details(course_id)<EOL><DEDENT>if course_details is None:<EOL><INDENT>LOGGER.error("<STR_LIT>",<EOL>enterprise_enrollment.pk, course_id)<EOL>continue<EOL><DEDENT>consent = DataSharingConsent.objects.proxied_get(<EOL>username=enterprise_enrollment.enterprise_customer_user.username,<EOL>course_id=enterprise_enrollment.course_id,<EOL>enterprise_customer=enterprise_enrollment.enterprise_customer_user.enterprise_customer<EOL>)<EOL>if not consent.granted or enterprise_enrollment.audit_reporting_disabled:<EOL><INDENT>continue<EOL><DEDENT>if course_details.get('<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>completed_date, grade, is_passing = self._collect_certificate_data(enterprise_enrollment)<EOL><DEDENT>else:<EOL><INDENT>completed_date, grade, is_passing = self._collect_grades_data(enterprise_enrollment, course_details)<EOL><DEDENT>records = self.get_learner_data_records(<EOL>enterprise_enrollment=enterprise_enrollment,<EOL>completed_date=completed_date,<EOL>grade=grade,<EOL>is_passing=is_passing,<EOL>)<EOL>if records:<EOL><INDENT>for record in records:<EOL><INDENT>yield record<EOL><DEDENT><DEDENT><DEDENT>
Collect learner data for the ``EnterpriseCustomer`` where data sharing consent is granted.

Yields a learner data object for each enrollment, containing:

* ``enterprise_enrollment``: ``EnterpriseCourseEnrollment`` object.
* ``completed_date``: datetime instance containing the course/enrollment completion date; None if not complete.
  "Course completion" occurs for instructor-paced courses when course certificates are issued, and
  for self-paced courses, when the course end date is passed, or when the learner achieves a passing grade.
* ``grade``: string grade recorded for the learner in the course.