Skip to content

Content Status endpoint + mass_update_ranked + mass_update default order endpoints#1910

Open
hepu wants to merge 21 commits into
masterfrom
feature/content-status
Open

Content Status endpoint + mass_update_ranked + mass_update default order endpoints#1910
hepu wants to merge 21 commits into
masterfrom
feature/content-status

Conversation

@hepu
Copy link
Copy Markdown
Contributor

@hepu hepu commented Nov 25, 2025

Summary

  • Added Content Status endpoint for app to consume and get statistics
  • Added /resources/default_order/mass_update endpoint to update a list of ResourceDefaultOrder records
  • Added /resources/featured/mass_update_ranked endpoint to update Resources with a score (creates/updates ResourceScores)

@hepu hepu requested review from andrewroth and frett November 25, 2025 14:03
@hepu hepu self-assigned this Nov 25, 2025
@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@hepu hepu changed the title Content Status endpoint Content Status endpoint + mass_update_ranked + mass_update default order endpoints Nov 26, 2025
@hepu hepu removed the On Staging label Nov 26, 2025
@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@hepu hepu added On Staging and removed On Staging labels Dec 3, 2025
@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@hepu hepu removed the On Staging label Dec 11, 2025
@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@stage-branch-merger
Copy link
Copy Markdown

I see you added the "On Staging" label, I'll get this merged to the staging branch!

@stage-branch-merger
Copy link
Copy Markdown

Merge conflict attempting to merge this into staging. Please fix manually.

@hepu hepu force-pushed the feature/content-status branch from a8c4f2d to 55a0e91 Compare January 14, 2026 21:50
@stage-branch-merger
Copy link
Copy Markdown

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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? }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants