Sort run prices on save; make learning resource prices equal "next run" prices #1085
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.
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/4585
Description (What does it do?)
LearningResource.pricesto return the prices of the resource's next run (if any).etl.loaders.load_runfunction to sort the list of prices before saving.How can this be tested?
LearningResourceRun.prices sort
backpopulate_mit_edx_data(you will need theEDX_API_settings from heroku). Check that the following returns some unsorted run prices:backpopulate_mit_edx_dataagain. This time, if you run the above code, no runs should be returnedLearningResource.prices
Go to
http://localhost:8063/api/v1/coursesand check that the resourcepricesfield is the same as for the next run of that resource.Additional Context
This PR won't update existing runs with unsorted price, but the ETL pipelines that will do so run every day.