Skip to content

Commit

Permalink
Filter out the collections from the file listing (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolyncole authored Dec 19, 2024
1 parent 11270b1 commit 11044ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def storage_capacity_raw(session_id:)
def file_list(session_id:, size: 10)
return { files: [] } if mediaflux_id.nil?

query_req = Mediaflux::QueryRequest.new(session_token: session_id, collection: mediaflux_id, deep_search: true)
query_req = Mediaflux::QueryRequest.new(session_token: session_id, collection: mediaflux_id, deep_search: true, aql_query: "type!='application/arc-asset-collection'")
iterator_id = query_req.result

iterator_req = Mediaflux::IteratorRequest.new(session_token: session_id, iterator: iterator_id, size: size)
Expand All @@ -275,7 +275,7 @@ def file_list(session_id:, size: 10)
def file_list_to_file(session_id:, filename:)
return { files: [] } if mediaflux_id.nil?

query_req = Mediaflux::QueryRequest.new(session_token: session_id, collection: mediaflux_id, deep_search: true)
query_req = Mediaflux::QueryRequest.new(session_token: session_id, collection: mediaflux_id, deep_search: true, aql_query: "type!='application/arc-asset-collection'")
iterator_id = query_req.result


Expand Down
4 changes: 4 additions & 0 deletions spec/models/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@
# Save the project in mediaflux
project.save_in_mediaflux(user: manager)

# create a collection so it can be filtered
Mediaflux::AssetCreateRequest.new(session_token: manager.mediaflux_session, name: "sub-collectoion", pid: project.mediaflux_id).resolve


# Create files for the project in mediaflux using test asset create request
Mediaflux::TestAssetCreateRequest.new(session_token: manager.mediaflux_session, parent_id: project.mediaflux_id, pattern: "Real_Among_Random.txt").resolve
Mediaflux::TestAssetCreateRequest.new(session_token: manager.mediaflux_session, parent_id: project.mediaflux_id, count: 7, pattern: "#{FFaker::Book.title}.txt").resolve
Expand Down
4 changes: 2 additions & 2 deletions spec/system/project_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
visit "/projects/#{project.id}/details"
expect(page).to have_selector(:link_or_button, "Content Preview")
click_on("Content Preview")
expect(page).to have_content("8 out of 22 shown")
expect(page).to have_content("8 out of 16 shown")
# expect(find(:css, "#file_count").text).to eq "16"

# Be able to return to the dashboard
Expand Down Expand Up @@ -197,7 +197,7 @@
expect(page).not_to have_content(last_file.name)

# files are paginated
find("a.paginate_button", text: 3).click
find("a.paginate_button", text: 2).click
expect(page).to have_content(last_file.name)
end

Expand Down

0 comments on commit 11044ca

Please sign in to comment.