Bug 326

Summary: Unable to output the result if user has no inputs and sort by performance
Product: Laptop Recommendation System Reporter: Antony Leung <kinnleung4-c>
Component: Laptop Recommendation SystemAssignee: Matthew <csng25-c>
Status: RESOLVED FIXED    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: PC   
OS: Windows   
Attachments: No changes after pressing the submit button
Correct output after fixing the bug

Description Antony Leung 2019-12-02 01:32:17 HKT
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
Comment 1 Antony Leung 2019-12-04 00:21:16 HKT
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.
Comment 2 Antony Leung 2019-12-04 01:17:52 HKT
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.