Bug 586

Summary: Weight 0 is considered as valid input
Product: Group31Bullship Reporter: Dennis Lai <cslai26-c>
Component: TransactionAssignee: Dennis Lai <cslai26-c>
Status: RESOLVED FIXED    
Severity: minor CC: tnchan27-c
Priority: ---    
Version: Demo 1.0   
Hardware: PC   
OS: Windows   

Description Dennis Lai 2021-11-20 18:59:06 HKT
Problem description:
Creating a transaction with weight 0 is considered as a valid input and transaction is created without any error messages.

Step to reproduce:
1. Click on "Calculator" tab.
2. Input 0 in "Weight" field.
3. Select a "Start point", "End point" and "Delivery Mode".
4. Press "Add and Create transaction".

Actual result:
No error message is prompted. A transaction with weight 0 is created.

Expected result:
Error message should prompted and notify user that the weight cannot be less than or equal to 0. The transaction should not be created until the user input is valid.
Comment 1 Matthew Chan 2021-12-04 17:33:06 HKT
This problem is caused by the checking of the weightValid function in the transactionBuilder class, which did not handle the case that returning false when weight equals 0.

This is fixed by setting <0 to <=0 while checking for weight.