Skip to content

Prevent invalid quick calculations and clarify calculation history - #172

Merged
mdrlzy merged 5 commits into
mainfrom
fix/quick-empty-target-crash
Aug 18, 2026
Merged

Prevent invalid quick calculations and clarify calculation history#172
mdrlzy merged 5 commits into
mainfrom
fix/quick-empty-target-crash

Conversation

@mdrlzy

@mdrlzy mdrlzy commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

📌 Description

  • Prevent invalid quick calculations from being saved
  • Add ValidateQuickCalculationUseCase as the shared source of validation
  • Use the validation use case for both the Save button state and the final save attempt
  • Log add_quick_invalid_calculation_attempt when an invalid save is attempted
  • Rename the unpinned calculations section to Calculation history
  • Add CleanupInvalidQuickCalculationsUseCase to remove previously saved invalid calculations when the Quick screen opens
  • Log quick_invalid_calculation_removed for each invalid calculation removed

val isValid =
from != null &&
currencies.size > 1 &&
from.value.toDoubleArk() != 0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return Option from toDoubleArk()?

@mdrlzy mdrlzy Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toDoubleArk() is a utility extension for converting a String to a number with tolerant parsing. This use case only needs a boolean validation result and treats an invalid value the same as zero, so returning Option would add unnecessary complexity here.

@shubertm shubertm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mdrlzy
mdrlzy merged commit 63992d7 into main Aug 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants