ucsb-cs156 / proj-happycows

https://ucsb-cs156.github.io/proj-happycows/
1 stars 0 forks source link

BUG: Disallow buying negative cows #92

Closed sangitakunapuli closed 5 months ago

sangitakunapuli commented 8 months ago

Have you updated the title?

Summary

When selecting a value in the popup modal to buy cows, you are able to input a negative value. This change also increases the profits value:

Screenshot 2024-02-20 at 6 03 29 PM

Screenshot 2024-02-20 at 6 03 49 PM

Expected Behavior

We need to disallow negative values from being input, and probably need to have a toolkit warning pop up if negative values are input into the textbox.

We can also consider having a Toast warning when the user clicks 'buy' to indicate that a negative amount of cows cannot be bought. The number of cows and wealth should not change.

Current / Observed Behavior

Currently, a user can manually input a negative value into the textbox to buy a "negative" number of cows. This changes the number of cows in the commons to be a negative value, and recalculates the total wealth value.

Steps to Reproduce

  1. Click the buy cows button
  2. Manually input a negative value (-3)
  3. Click 'buy'

Browser / Platform Info

Chrome on MacOS