Skip to content

Conversation

@marlo-longley
Copy link
Contributor

@marlo-longley marlo-longley commented Oct 23, 2025

Closes #1262

You can view this at URLs like /organizations/cornell/streams/48d9316f-85fc-4e38-8dcb-b22f1407301c

Because the views/uploads/_file_table.html.erb is used by two different controllers / show pages -- uploads and streams -- this got a little weird. Both views want to render the table, but the internal paths for filtering are different -- and in the case of /uploads/:id we don't even want the filtering.

@marlo-longley marlo-longley force-pushed the activity-filters branch 5 times, most recently from 861117e to 4495731 Compare October 24, 2025 21:00
@marlo-longley marlo-longley marked this pull request as ready for review October 24, 2025 21:07
if params[:filter].present?
filter_status = params[:filter].to_sym

filtered_ids = @uploads.select do |upload|
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is going to scale to thousands (or 100k+ uploads). There's probably a faster but more annoying/complex way to do this with joins:

You'd need to combine multiple where conditions depending on the filter...but:

stream.uploads.joins(:files_blobs).where('active_storage_blobs.metadata LIKE ?', '%"analyzer":"MarcAnalyzer"%')

end

# Reset to page 1 if a filter is applied
page_number = params[:filter].present? ? 1 : params[:page]
Copy link
Member

Choose a reason for hiding this comment

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

Won't this mean that paging won't work if a filter is applied?

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.

Create uploaded files filter

3 participants