molbal / abyss-tracker

EVE Online Abyss loot tracker webapplication
https://abyss.eve-nt.uk
GNU Affero General Public License v3.0
22 stars 3 forks source link

Badge for Hull Size Defaults to "CRUISER SIZE SHIPS" on Runs Search Results Page #112

Closed Aalve closed 2 years ago

Aalve commented 2 years ago

Describe the bug Badge for hull size criteria on search results page ("search/execute" route) defaults to "Cruiser" no matter what is picked, however the condition for the query is what is selected, so the results still match.

To Reproduce Steps to reproduce the behavior:

  1. Go to "Runs" page: https://abyss.eve-nt.uk/search
  2. Choose a "Hull Size" that is not "Cruiser size"
  3. Press "Search"
  4. On resulting page load, look at the top under "Displaying" and the badge should incorrectly read "CRUISER SIZE SHIPS"

Expected behavior On step 4 of the reproduction steps, the badge should show the appropriate hull size you chose on the previous page from step 1.

Screenshots image

image

Desktop (please complete the following information):

Additional context I believe the issue is this line: https://github.com/molbal/abyss-tracker/blob/146891da9106b34595fee517283f59b2e7251c81/app/Http/Controllers/SearchController.php#L83

The encapsulating if statement already checks if the field was filled, so the condition for this ternary operator will always resolve to true and choose "Cruiser" for this SearchCriteria's name. However, the actual selected value is set as its value, so we end up seeing frigate results with the "CRUISER SIZE SHIPS" badge.

molbal commented 2 years ago

Excellent catch - thank you for taking the time to pinpoint the root cause as well

molbal commented 2 years ago

Scheduled for release 1.11 (but already patched)