| Summary: | Incorrect return values when calculating percentage of the maximum sales | ||
|---|---|---|---|
| Product: | online shop management system | Reporter: | gkpcheung3-c |
| Component: | Sales System | Assignee: | gkpcheung3-c |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | nokyinng3-c |
| Priority: | Normal | ||
| Version: | 1.0.0 | ||
| Hardware: | PC | ||
| OS: | Windows | ||
|
Description
gkpcheung3-c
2020-11-01 17:24:16 HKT
Step of the test: 1. Find the maximum sales of the product in the database. 2. Calculate the percentage by maximum sales divided by the total number of sales. 3. Round up the result. 4. Calculate the expected percentage. 5. Compare the actual percentage(from step 2 and 3) with the expected percentage(from step 4). The bug fixed successfully. The bug was fixed by adding a statement to convert the type of max and totalSales from int to double. Otherwise, in the test case, the result of max divided by totalSales will be incorrect as the type is int. To get the correct calculation, the type needs to convert to double first. |