Created attachment 33 [details] No changes after pressing the submit button Overview: Sorting by performance do not output any result if no inputs are chosen. Steps to Reproduce: 1) Do not input any information. 2)Choose the Sort By Performance option. 3)Press Submit button. Actual Results: There are no changes in the display window which is the as the default output. Expected Results: The array list displayed should be arranged according to their hardware spec. Build Date & Hardware: Build 2019-11-15 on Mac OS 10.14.5 & Windows 10
Created attachment 34 [details] Correct output after fixing the bug Debug steps: 1) reproduce the bug as mentioned 2) input all fields and find out which field trigger the bug Observations: No bugs triggered if at least one field has input. The bug will only trigger when there is no input and it will skip the sorting. Suggested solution: We remove the if/then clause which it did not return any arraylist before. Once the class is called, it will return an arraylist.
Correct output after fixing the bug Debug steps: 1) reproduce the bug as mentioned 2) input all fields and find out which field trigger the bug Observations: No bugs triggered if at least one field has input. The bug will only trigger when there is no input and it will skip the sorting. Suggesetion: We remove the if/then clause which it would return the original arraylist without sorting if there are no inputs. The code removed: if(pname.isEmpty() && brand.isEmpty() && cpu.isEmpty() && gpu.isEmpty() && weight_low == -1 && weight_up == -1 && monitorSize_low == -1 && monitorSize_up == -1 && price_low == -1 && price_up == -1) { return new ArrayList<Laptop>(laptopList); } After removing the code, once the class is called, it will return a sorted arraylist. (In reply to Antony Leung from comment #1) > Created attachment 34 [details] > Correct output after fixing the bug > > Debug steps: > 1) reproduce the bug as mentioned > > 2) input all fields and find out which field trigger the bug > > Observations: > No bugs triggered if at least one field has input. The bug will only trigger > when there is no input and it will skip the sorting. > > Suggested solution: > We remove the if/then clause which it did not return any arraylist before. > Once the class is called, it will return an arraylist.