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

Dependent fields in StockData #142

Open
georgeef opened this issue Oct 13, 2024 · 0 comments
Open

Dependent fields in StockData #142

georgeef opened this issue Oct 13, 2024 · 0 comments
Labels
r: feature Request: New feature t: stock Topic: Stock
Milestone

Comments

@georgeef
Copy link
Contributor

The following fields in StockData are dependent:

  • purchaseValue = purchasePrice * numShares

Although this dependency can be enforced in new Stock records by the application, existing records in a database file may not be consistent.

Handling of dependent information in Stock Views

For new stock records, purchaseValue can be a calculated (read-only) field in StockEditView. The stock dialog in MMEX Desktop accepts purchasePrice as input and calculates purchaseValue.

For existing stock records with inconsistent purchaseValue, an error indicator can be shown, together with a button to fix the inconsistency.

Some care is needed in order to check the equality of two Double numbers. Since both sides of the equation represent an amount, they can be converted to String with the applicable currency formatter, after which the amount comparison reduces to a String comparison.

Handling of dependent information in reports

MMEX Desktop mostly uses purchaseValue as source of truth in reports. mmex-ios can do the same.

@georgeef georgeef added this to the v1.0 milestone Oct 13, 2024
@georgeef georgeef added r: feature Request: New feature i: todo Information: Reminder of planned work t: stock Topic: Stock and removed i: todo Information: Reminder of planned work labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: feature Request: New feature t: stock Topic: Stock
Projects
None yet
Development

No branches or pull requests

1 participant