Bug 497

Summary: Added products are not shown
Product: Group 4 Reporter: kykao2-c
Component: MainAssignee: aaronlii2-c
Status: RESOLVED FIXED    
Severity: major CC: chlam286-c, kykao2-c, plchan83-c, sharitsang97
Priority: High    
Version: unspecified   
Hardware: Macintosh   
OS: Mac OS   
Deadline: 2020-11-06   
Attachments: Added products not shown

Description kykao2-c 2020-11-28 19:01:17 HKT
Created attachment 61 [details]
Added products not shown

After I have added the product to the database, the queryProduct and listProduct command show there is no product in the database.

Device specification:
MacOS: Mojave version 10.14.6 [Device: Macbook Pro 2017, 13-inch]

Severity: Major.

Step to reproduce the bug:
input:   1. "addProduct productID_1 appleJuice 20.99 200"
output:     "Product appleJuice (PID: productID_1) has been added."

input:   2. "queryProduct productID_1"
output:     "Product not found."

input:   3. "listProduct"
output:     "No product record."

Observation:
There is a wrong implementation on either "addProduct" command or both "queryProduct" and "listProduct" command.

Expectation:
The program returns the information of the added product(s). 

Expected Output:
input:   1. "addProduct productID_1 appleJuice 20.99 200"
output:     "Product appleJuice (PID: productID_1) has been added."

input:   2. "queryProduct productID_1"
output:
            PID           Name          Price          Stock
    productID_1     appleJuice          20.99            200

input:   3. "listProduct"
output:
            PID           Name          Price          Stock
    productID_1     appleJuice          20.99            200

Solution:
There are two possibilities - either the addProduct function is implemented incorrectly or the queryProduct and listProduct do not produce the result correctly. The first one implies the product has not been added to the database but it returns a wrong message. This should be further inspected.
Comment 1 aaronlii2-c 2020-11-29 11:39:52 HKT
I have found that the addProduct function does not add the product to the product database. This has been fixed, and the expected output works now.

- Aaron