ita-social-projects / ZeroWaste

Waste calculator for Zero Waste Lviv organization
MIT License
10 stars 11 forks source link

[Products] There is possibility to enter an unlimited number of decimals after the dot #817

Open Ytrygub opened 8 months ago

Ytrygub commented 8 months ago

Environment: Windows 10 Pro 22H2 Google Chrome Version 122.0.6261.112 (Official Build) (64-bit) Reproducible: always

Preconditions

  1. Site https://zero-waste-staging.onrender.com/en is opened.
  2. Admin is logged in

Steps to reproduce

  1. Go to 'Products' page
  2. Click on 'Add product' button
  3. Enter title name in the 'Title' field (e.g. decimal numbers)
  4. Put a tick in necessary checkbox
  5. Enter decimal number with unlimited number of decimals after the dot in 'Sum' field (e.g. 1.23456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)
  6. Click 'Cancel' button
  7. Click 'Edit' icon on any of the rows with existing products
  8. Repeat steps 4-5

Actual result There is possibility to enter an unlimited number of decimals after the dot

Expected result There should be a restriction on entering too long decimal numbers

User story and test case links E.g.: "User story #424 Test case"

https://github.com/ita-social-projects/ZeroWaste/assets/145603083/65ba09fe-79d2-4742-91dd-db861a142308

obniavko commented 5 months ago

В базі даних встановлено обмеження на 2 знаки після коми (t.decimal "sum", precision: 8, scale: 2), тому введені значення при збереженні округлюються до двох знаків після коми. Переміщено в No status.

loqimean commented 1 day ago

comment

https://github.com/ita-social-projects/ZeroWaste/pull/933#pullrequestreview-2414808937