Bug 586 - Weight 0 is considered as valid input
Summary: Weight 0 is considered as valid input
Status: RESOLVED FIXED
Alias: None
Product: Group31Bullship
Classification: Unclassified
Component: Transaction (show other bugs)
Version: Demo 1.0
Hardware: PC Windows
: --- minor
Assignee: Dennis Lai
URL:
Depends on:
Blocks:
 
Reported: 2021-11-20 18:59 HKT by Dennis Lai
Modified: 2021-12-04 17:33 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.