SpeciesFileGroup / taxonworks

Workbench for biodiversity informatics.
http://taxonworks.org
MIT License
87 stars 27 forks source link

[Bug]: Searching by OTU in Filter Loans broken #4087

Closed tmcelrath closed 3 weeks ago

tmcelrath commented 1 month ago

Steps to reproduce the bug

1. When I want to search loans by OTU
2. Then I enter an OTU
3. All loans are returned
...

Screenshot

No response

Expected behavior

Should only return loans with loan objects that have that OTU in Filter Loans

Additional Screenshots

No response

Environment

Production

Sandbox Used

No response

Version

0.44.3

Browser Used

Firefox

debpaul commented 3 weeks ago

@tmcelrath can you provide a specific OTU where this happens? or verify what I'm seeing below is what you're seeing?

I just tested on a random OTU Melissodes (Eumelissodes) saponellus Cockerell, 1908

  1. Filter Loans

  2. OTU = Melissodes (Eumelissodes) saponellus Cockerell, 1908

  3. JSON request: https://sfg.taxonworks.org/loans/filter.json?per=50&otu_id%5B%5D=197256&page=1

  4. Returns (all?) loan records (see screenshot, 3570 rows) image

  5. IF I then ADD that same name string in Filter Loans > TaxonName field, and click Filter I get 3 records.

  6. JSON Request: https://sfg.taxonworks.org/loans/filter.json?per=50&taxon_name_id%5B%5D=583403&otu_id%5B%5D=197256&page=1 image

Continuing this exploration

  1. Filter CO where OTU = Melissodes (Eumelissodes) saponellus Cockerell, 1908 returns 21 records
  2. JSON Request: https://sfg.taxonworks.org/collection_objects/filter.json?per=50&otu_id%5B%5D=197256&extend%5B%5D=dwc_occurrence&extend%5B%5D=repository&extend%5B%5D=current_repository&extend%5B%5D=collecting_event&extend%5B%5D=taxon_determinations&extend%5B%5D=identifiers&exclude%5B%5D=object_labels image
  3. Pass the results using left-side filter to Loans, returns 2 records
  4. JSON Request: https://sfg.taxonworks.org/loans/filter.json?per=50&collection_object_query%5Botu_id%5D%5B%5D=197256 image

I see 3 records in the first scenario, only 2 in the 2nd. Not sure why of course. Though I'm hoping this helps the developers see the issue.

@tmcelrath for this case, please which of the above is returning the expected result, if any? Can you tell?

mjy commented 3 weeks ago

@tmcelrath I've replicated the problem. @debpaul the first scenario. This doesn't reference TaxonName.