nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Bug fixes to restrict the maximum points added #844

Closed kinjalagarwal1810 closed 7 months ago

kinjalagarwal1810 commented 7 months ago

[Q5] Can we tweak validity checks for a user input, or error/exception handling?

A: Can be allowed only if the current behavior causes the software to misbehave (i.e., crash, give incorrect results, store inconsistent data, or make it unusable for typical users).

Hi Prof, our application has a few commands that accept Points as a parameter. e.g. addpts n/Alex p/1000, addmempts n/James mp/50000, additem i/Chocolate p/7000

However, in v1.3 we did not not put a limit on the number of points. Now, if we add a large but reasonable number of points there is an integer overflow problem and the value becomes negative. Since we are using a Points variable, it is very likely that a typical user may input these large values as the Points only increases for the person's whole lifetime. Moreover, since all our commands are related, this overflow can result in other functions failing as well.

Hence, we believe it is giving incorrect results when we use commands like addpts as the value becomes negative after 2,147,483,647.

As such, is this considered a bug and can we restrict the max number of points someone can have for the usability of the app for a typical user?

damithc commented 7 months ago

@kinjalagarwal1810 we don't expect users to use v1.4 for their entire lifetime, as v1.5 is expected to be released in two weeks (if we follow the same release cycle). So, it is unlikely a user will reach that limit before that. Hence, updating the UG to caution users of this limitation should suffice.