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

allow weight field to take decimals #4

Open
HarleyCarter1234 opened this issue Dec 30, 2023 · 2 comments · May be fixed by #16
Open

allow weight field to take decimals #4

HarleyCarter1234 opened this issue Dec 30, 2023 · 2 comments · May be fixed by #16
Labels
enhancement New feature or request

Comments

@HarleyCarter1234
Copy link

Weight field does not currently allow decimals and seems to expect a whole number

Change 'weight' field from int to single/double etc

Trying to enter 102.5 for example fails

@HarleyCarter1234
Copy link
Author

should have maybe added that I'm in the UK and measuring weights in KG

@aceberg aceberg added the enhancement New feature or request label Jan 3, 2024
@chandz05
Copy link

Would like this too please! Rounding up/down to the nearest whole number makes the graph fluctuate weirdly, even in freedom lbs.

Judge40 added a commit to Judge40/ExerciseDiary that referenced this issue Oct 19, 2024
Use the `shopspring/decimal` library to add support for decimal weight
values.

 - Change each `Weight` field's type to `decimal.Decimal`
 - Replace `strconv.Atio()` with `decimal.NewFromString()` for Weight
 - Modify SQL statements to insert the decimal value
 - Update weight inputs to allow decimal places and a min value of zero
 - Set chart weight axis precision to zero so charts are not changed for
   users not using decimals

This approach works without modifying the column type due to SQLite's
type affinity. Ideally the column type would be changed to a more
suitable type to better support other DBs, like PostgreSQL, in the
future. However, that would require decisions to be made around
migration processes, which may be better deferred until that work is
undertaken.

Resolves aceberg#4
Judge40 added a commit to Judge40/ExerciseDiary that referenced this issue Oct 19, 2024
Use the `shopspring/decimal` library to add support for decimal weight
values.

 - Change each `Weight` field's type to `decimal.Decimal`
 - Replace `strconv.Atio()` with `decimal.NewFromString()` for Weight
 - Modify SQL statements to insert the decimal value
 - Update weight inputs to allow decimal places and a min value of zero
 - Set chart weight axis precision to zero so charts are not changed for
   users not using decimals

This approach works without modifying the column type due to SQLite's
type affinity. Ideally the column type would be changed to a more
suitable type to better support other DBs, like PostgreSQL, in the
future. However, that would require decisions to be made around
migration processes, which may be better deferred until that work is
undertaken.

Resolves aceberg#4
Judge40 added a commit to Judge40/ExerciseDiary that referenced this issue Oct 19, 2024
Use the `shopspring/decimal` library to add support for decimal weight
values.

 - Change each `Weight` field's type to `decimal.Decimal`
 - Replace `strconv.Atio()` with `decimal.NewFromString()` for Weight
 - Modify SQL statements to insert the decimal value
 - Update weight inputs to allow decimal places and a min value of zero
 - Set chart weight axis precision to zero so charts are not changed for
   users not using decimals

This approach works without modifying the column type due to SQLite's
type affinity. Ideally the column type would be changed to a more
suitable type to better support other DBs, like PostgreSQL, in the
future. However, that would require decisions to be made around
migration processes, which may be better deferred until that work is
undertaken.

Resolves aceberg#4
Judge40 added a commit to Judge40/ExerciseDiary that referenced this issue Oct 19, 2024
Use the `shopspring/decimal` library to add support for decimal weight
values.

 - Change each `Weight` field's type to `decimal.Decimal`
 - Replace `strconv.Atio()` with `decimal.NewFromString()` for Weight
 - Modify SQL statements to insert the decimal value
 - Update weight inputs to allow decimal places and a min value of zero

This approach works without modifying the column type due to SQLite's
type affinity. Ideally the column type would be changed to a more
suitable type to better support other DBs, like PostgreSQL, in the
future. However, that would require decisions to be made around
migration processes, which may be better deferred until that work is
undertaken.

Resolves aceberg#4
@Judge40 Judge40 linked a pull request Oct 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants