Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expense update error - expense record doesn't exist #3

Open
eddyharrington opened this issue May 27, 2020 · 1 comment
Open

Expense update error - expense record doesn't exist #3

eddyharrington opened this issue May 27, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@eddyharrington
Copy link
Owner

Some users are reporting that when they try to update an expense record, they get an error message: "The expense record you're trying to update doesn't exist"

@eddyharrington eddyharrington added the bug Something isn't working label May 27, 2020
@eddyharrington eddyharrington self-assigned this May 27, 2020
@eddyharrington
Copy link
Owner Author

eddyharrington commented May 27, 2020

Root cause of this is because all of the monetary value columns use data type 'REAL' which is imprecise. According to Postgres docs, 'NUMERIC' data type is the solution to this problem:

The data types real and double precision are inexact, variable-precision numeric types. Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and retrieving a value might show slight discrepancies. If you require exact storage and calculations (such as for monetary amounts), use the numeric type instead.

Tables | Columns that need to be updated from real to numeric(8,2):

  • users | income
  • expenses | amount
  • budgets | amount

Front-end changes that need regex to be updated to prevent more than 8 digits, 2 precision:

  • dashboard
  • addexpense
  • createbudget
  • updatebudget

Back-end can be improved to also check for numeric constraints, otherwise user will face 'Internal Error' message if for some reason they are able to enter a numeric with more than 8 digits or 2 precision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant