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

fix: CSV loader reverting future runs to in LegalReview #4508

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

AfaqShuaib09
Copy link
Contributor

@AfaqShuaib09 AfaqShuaib09 commented Dec 4, 2024

PROD-4243

This PR fixes an issue in the CSV loader where future runs were being reverted to the LegalReview state.

We have added a check in the CSV loader to complete the review cycle if a course run is in LegalReview.

Previously, changing the enrollment_end date moved the run to the LegalReview state as it is a non-exempt field. To address this behavior, we have added the above condition

@AfaqShuaib09 AfaqShuaib09 marked this pull request as ready for review December 4, 2024 18:22
# url slug is correctly generated in subdirectory format
course_run.status = CourseRunStatus.LegalReview
course_run.save(update_fields=['status'], send_emails=False)
course_run.refresh_from_db()
Copy link
Contributor Author

@AfaqShuaib09 AfaqShuaib09 Dec 4, 2024

Choose a reason for hiding this comment

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

Moved this refresh_from_db() above to get the updated status and complete the review cycle in one go

course_run = CourseRun.everything.get(course=course, draft=True)

self._assert_course_data(course, {**self.BASE_EXPECTED_COURSE_DATA})
assert course_run.status == CourseRunStatus.Reviewed
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why is the status reviewed and not published? I don't see any dates data to assert this is a future variant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because of this _complete_run_review which is calling complete_review_phase which is moving the course_run to reviewed Status. However code changes works fine, we can add a refresh_from_db call after the _complete_run_review statement to refresh the course_run status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦🏻 Figured out the issue, go_live_date is empty for the run because the run is in the review_in_legal state, so the course_run data doesn't get updated—only the status changes. In the subsequent run, the course_run data will be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, the code is written in such a way that it ends up moving the course to the review_by_legal status when the command is completed

@AfaqShuaib09 AfaqShuaib09 merged commit 3e1d67e into master Dec 5, 2024
12 checks passed
@AfaqShuaib09 AfaqShuaib09 deleted the afaq/PROD-4243 branch December 5, 2024 20:25
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