Content Status endpoint + mass_update_ranked + mass_update default order endpoints#1910
Content Status endpoint + mass_update_ranked + mass_update default order endpoints#1910hepu wants to merge 21 commits into
Conversation
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
…endpoint for ranked resources
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
|
Merge conflict attempting to merge this into staging. Please fix manually. |
a8c4f2d to
55a0e91
Compare
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
| remove_index :resource_scores, [:language_id, :country] if index_exists?(:resource_scores, [:language_id, :country]) | ||
| remove_column :resource_scores, :language_id, :integer if column_exists?(:resource_scores, :language_id) | ||
|
|
||
| add_column :resource_scores, :lang |
There was a problem hiding this comment.
this should have a type , :string
| lang = params.dig(:filter, :lang) || params[:lang] | ||
|
|
||
| if lang.present? | ||
| language = Language.where("code = :lang OR LOWER(code) = LOWER(:lang)", lang: lang).first |
There was a problem hiding this comment.
This particular check happens a lot and would be good to add a Language.find_by_code(lang). Also, the code = :lang is redundant as LOWER(code) = LOWER(:lang) will match it.
|
|
||
| current_orders = current_orders.to_a | ||
|
|
||
| if incoming_resources.empty? |
There was a problem hiding this comment.
There's a transaction below, and one here would be good I think, so if one fails we're not left with a partially updated list.
| current_orders.each do |ro| | ||
| ro.destroy! | ||
| end | ||
| current_orders.reject! { |ro| !ro.persisted? } |
There was a problem hiding this comment.
I think by this line, we're guaranteed that all current_orders have been deleted or an error would be raised from destroy! and caught down at line 134. We can just render json: []
Summary
/resources/default_order/mass_updateendpoint to update a list of ResourceDefaultOrder records/resources/featured/mass_update_rankedendpoint to update Resources with a score (creates/updates ResourceScores)