Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: take exec ed course data from course run instead of additional_metadata attempt 4 #988

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

marlonkeating
Copy link
Contributor

Description

Updates references for Exec Ed courses originally contained in the additional_metadata field, to now be taken from course runs. This new version fixes datetime parsing issue that was found in earlier attempt #966, and adds additional guardrails and logging around future unexpected parsing errors.

Post-review

  • Squash commits into discrete sets of changes
  • Ensure that once the changes have been deployed to stage, prod is manually deployed

indexable_course_keys.add(course_metadata.content_key)
else:
nonindexable_course_keys.add(course_metadata.content_key)
except Exception as e: # pylint: disable=broad-exception-caught
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] Change from #966 to catch issue and prevent it from stopping the whole indexing process, while logging any future parsing issues (along with the culprit's content_key).

},
# Error cases for invalid enrollment_end values
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] Change from #966 to test two data cases that resulted in the error we saw in Prod: TypeError: fromisoformat: argument must be str

Comment on lines 259 to 260
# The check should fail if the enroll by date isn't present or can't be parsed
return True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[sanity check] If a course doesn't have an enroll-by date, is it semantically correct to return True for _has_enroll_by_deadline_passed? That is, how could the enroll by deadline be passed when there is no deadline present?

I believe this might prevent courses without an enroll-by date from being indexed into Algolia due to the deadline_passed_checker method in _should_index_course; not sure if that's intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if courses lacking an enroll-by date is a valid scenario, and shouldn't be disqualified from indexing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually, a course without an enroll-by date means there is no deadline to enroll, so as long as the other properties checks within is_course_run_active are fulfilled (e.g., status="published", is_enrollment=True, is_marketable=True) the course should still be discoverable despite null enroll-by date since it's otherwise still enrollable.

We have handled null enroll-by date in at least a couple places in the past, at least within a couple frontend spots, e.g.

  • Related to which course runs appear during the assignment allocation flow in Admin Portal (source). That is, isEnrollByDateWithinThreshold always returns true if there is no enroll by date.
  • Related to determining whether an audit enrollment is potentially upgradable in the Learner Portal (source). That is, within isEnrollmentUpgradeable, isEnrollByLapsed always returns false when no enroll-by date is present. isEnrollByLapsed is largely synonymous with _has_enroll_by_deadline_passed.

…metadata attempt 4

chore: Add space in logging

fix: courses without enroll-by date should be indexed
@marlonkeating marlonkeating merged commit 4722f06 into master Oct 29, 2024
4 checks passed
@marlonkeating marlonkeating deleted the mkeating/ENT-8248-4 branch October 29, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants