Skip to content

Commit

Permalink
Fix amount implementation for pumping entries
Browse files Browse the repository at this point in the history
  • Loading branch information
MrApplejuice committed Jul 24, 2024
1 parent f70e526 commit bcbb4ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ class PumpingLoggingController(
fragment: BaseFragment,
childId: Int,
timerControl: TimerControlInterface
) : GenericLoggingController(fragment, childId, timerControl, TummyTimeEntry::class) {
) : GenericLoggingController(fragment, childId, timerControl, PumpingEntry::class) {
val pumpingBinding = PumpingLoggingEntryBinding.inflate(fragment.layoutInflater)

override val uiCurrentTimerTime = pumpingBinding.currentTimerTime
Expand All @@ -723,7 +723,7 @@ class PumpingLoggingController(
amountNumberPicker.value = 0.0

fragment.mainActivity.storage.child<PumpingRecord>(childId, "pumping")?.let {
amountNumberPicker.value = it.amount
amountNumberPicker.value = it.amount ?: 0.0
uiNoteEditor.setText(it.note)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class HorizontalDecIncEditor : LinearLayout {
return binding.numberEditor.text.toString().toDoubleOrNull()
}
set(value) {
val v = value?.let {
if (it < 0) {
val v = value.let {
if ((it == null) || (it < 0.0)) {
if (allowNull) {
return@let null
} else {
return@let 0.0
}
return@let 0.0
}
it
}
Expand Down

0 comments on commit bcbb4ca

Please sign in to comment.