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

Copy courses between providers in Support console #4750

Merged
merged 12 commits into from
Dec 10, 2024

Conversation

inulty-dfe
Copy link
Contributor

@inulty-dfe inulty-dfe commented Dec 5, 2024

Context

Support are often asked to copy courses from one provider to another. This PR provides the ability for users to copy courses via the Support console.

Considerations

  1. Copy all courses
  2. Copy schools and study sites or not
  • What if the target provider already has copied the courses?
    • The courses are not recopied
  • What if the target provider already has copied the courses and deleted them?
    • The courses are not recopied
  • What if there are 1000 courses
    • It will take a while to copy all the courses across.
  • Could this be a background process?
    • Lets see if that is necessary

Changes proposed in this pull request

Screencast.from.09-12-24.15.27.18.webm

Guidance to review

@inulty-dfe inulty-dfe added the deploy A Review App will be created for PRs with this label label Dec 5, 2024
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch 2 times, most recently from 5cc9ed6 to 77c8835 Compare December 5, 2024 12:52
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from 35fd5a2 to fc162d3 Compare December 5, 2024 17:27
  add test for copying schools
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from fc162d3 to 6f006a7 Compare December 6, 2024 10:58
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch 4 times, most recently from f53bf6c to 7e27485 Compare December 9, 2024 10:33
  Cannot get chromedriver to run the tests on the Alpine image
  These packages are needed at least: gcompat glib nss libxcb libgcc chromium
  Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]

  The test fails when chromedriver cannot connect on the socket
  2024-12-09 12:28:48 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from 7e27485 to 07eaba3 Compare December 9, 2024 12:43
@inulty-dfe
Copy link
Contributor Author

@inulty-dfe inulty-dfe marked this pull request as ready for review December 9, 2024 13:02
@inulty-dfe inulty-dfe requested a review from a team as a code owner December 9, 2024 13:02
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from 0022fe6 to afcf251 Compare December 9, 2024 15:07
copier = ::Courses::CopyToProviderService.new(sites_copy_to_course:, enrichments_copy_to_course: Enrichments::CopyToCourseService.new, force: true)

Provider.transaction do
@copy_courses_form.provider.courses.map do |course|
Copy link
Contributor

Choose a reason for hiding this comment

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

On the PR description it mentions "Copy all courses or some courses" but here is all courses. Can we remove the "some courses" from description just to avoid confusion?

I assume the copying specific courses would be done on a later interaction when we will have a support ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I've not implemented "some courses" because unwanted courses can be deleted

end
end

redirect_to support_recruitment_cycle_provider_path(recruitment_cycle.year, @copy_courses_form.target_provider.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any indication everything went sucessfully? Should we add one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screencast.from.10-12-24.10.47.38.webm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to redirect to the courses tab too

Copy link
Contributor

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

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

Minor questions but tested and it worked ✌️

@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from 84d4eae to 4438f47 Compare December 10, 2024 13:04
  redirect to the courses tab after copy
@inulty-dfe inulty-dfe force-pushed the im/copy-courses-between-providers branch from 4438f47 to 075b4b7 Compare December 10, 2024 13:19
@inulty-dfe inulty-dfe merged commit 075c21b into main Dec 10, 2024
19 checks passed
@inulty-dfe inulty-dfe deleted the im/copy-courses-between-providers branch December 10, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants