-
Notifications
You must be signed in to change notification settings - Fork 19
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 3 #966
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,7 @@ def course_run_not_active_checker(): | |
return not is_course_run_active(advertised_course_run) | ||
|
||
def deadline_passed_checker(): | ||
return _has_enroll_by_deadline_passed(course_json_metadata, advertised_course_run) | ||
return _has_enroll_by_deadline_passed(course_json_metadata) | ||
|
||
for should_not_index_function, log_message in ( | ||
(no_advertised_course_run_checker, 'no advertised course run'), | ||
|
@@ -243,22 +243,13 @@ def deadline_passed_checker(): | |
return True | ||
|
||
|
||
def _has_enroll_by_deadline_passed(course_json_metadata, advertised_course_run): | ||
def _has_enroll_by_deadline_passed(course_json_metadata): | ||
""" | ||
Helper to determine if the enrollment deadline has passed for the given course | ||
and advertised course run. For course metadata records with a `course_type` of "course" (e.g. OCM courses), | ||
this is based on the verified upgrade deadline. | ||
For 2u exec ed courses, this is based on the registration deadline. | ||
""" | ||
enroll_by_deadline_timestamp = 0 | ||
if course_json_metadata.get('course_type') == EXEC_ED_2U_COURSE_TYPE: | ||
additional_metadata = course_json_metadata.get('additional_metadata') or {} | ||
registration_deadline = additional_metadata.get('registration_deadline') | ||
if registration_deadline: | ||
enroll_by_deadline_timestamp = parse_datetime(registration_deadline).timestamp() | ||
else: | ||
enroll_by_deadline_timestamp = _get_verified_upgrade_deadline(advertised_course_run) | ||
|
||
based on normalized_metadata's enroll_by_date | ||
""" | ||
enroll_by_deadline = course_json_metadata.get('normalized_metadata')['enroll_by_date'] | ||
enroll_by_deadline_timestamp = parse_datetime(enroll_by_deadline).timestamp() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the one line fixed from https://github.com/openedx/enterprise-catalog/pull/912 |
||
return enroll_by_deadline_timestamp < localized_utcnow().timestamp() | ||
|
||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳