Skip to content

Commit

Permalink
add ontology submissions filter by status (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni authored Nov 1, 2023
1 parent 9fb09a2 commit 1602a31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers/request_params_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def apply_submission_filters(query)
isOfType: params[:isOfType]&.split(','), #["http://omv.ontoware.org/2005/05/ontology#Vocabulary"],
hasFormalityLevel: params[:hasFormalityLevel]&.split(','), #["http://w3id.org/nkos/nkostype#thesaurus"],
ontology_viewingRestriction: params[:viewingRestriction]&.split(','), #["private"]
status: params[:status]&.split(','), #"retired",
}
inverse_filters = {
status: params[:status], #"retired",
submissionStatus: params[:submissionStatus] #"RDF",
}

Expand Down
14 changes: 14 additions & 0 deletions test/controllers/test_ontology_submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def test_submissions_pagination_filter
ontologies.first.name = "sort by test"
ontologies.first.save
sub = ontologies.first.latest_submission(status: :any).bring_remaining
sub.status = 'retired'
sub.creationDate = DateTime.yesterday.to_datetime
sub.hasOntologyLanguage = LinkedData::Models::OntologyFormat.find('SKOS').first
sub.save
Expand Down Expand Up @@ -349,6 +350,19 @@ def test_submissions_pagination_filter
submissions = MultiJson.load(last_response.body)
refute_empty submissions["collection"]
assert_equal ontologies2.size + 1 , submissions["collection"].size

# test ontology filter with status
get "/submissions?page=1&pagesize=100&status=retired"
assert last_response.ok?
submissions = MultiJson.load(last_response.body)
refute_empty submissions["collection"]
assert_equal 1 , submissions["collection"].size

get "/submissions?page=1&pagesize=100&status=alpha,beta,production"
assert last_response.ok?
submissions = MultiJson.load(last_response.body)
refute_empty submissions["collection"]
assert_equal ontologies.size - 1 , submissions["collection"].size
end

def test_submissions_default_includes
Expand Down

0 comments on commit 1602a31

Please sign in to comment.