Skip to content

Commit

Permalink
Fix weight saving bug (#209)
Browse files Browse the repository at this point in the history
* Revert change to weight saving

* Update versionCode and versionName
  • Loading branch information
slavick authored Aug 18, 2022
1 parent c89d673 commit 979e897
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
minSdkVersion 16
targetSdkVersion 30
vectorDrawables.useSupportLibrary = true
versionCode 72
versionName "21.2"
versionCode 73
versionName "21.3"
}
buildTypes {
debug {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ public static boolean createWeightsIfDoesNotExist(final Day day, float morningWe

if (weights == null) {
weights = new Weights(day, morningWeight, eveningWeight);
}

if (weights.morningWeight != morningWeight || weights.eveningWeight != eveningWeight) {
} else {
weights.setMorningWeight(morningWeight);
weights.setEveningWeight(eveningWeight);
weights.save();
return true;
}

return false;
weights.save();

return true;
}

public static Weights getWeightsOnDay(final Day day) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,8 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

if (morningWeight > 0 || eveningWeight > 0) {
day = Day.createDayIfDoesNotExist(day);
boolean weightSaved = Weights.createWeightsIfDoesNotExist(day, morningWeight, eveningWeight);
if (weightSaved) {
Timber.d("Saving morning weight [%s] and evening weight [%s]", morningWeight, eveningWeight);
}
Weights.createWeightsIfDoesNotExist(day, morningWeight, eveningWeight);
Timber.d("Saving morning weight [%s] and evening weight [%s]", morningWeight, eveningWeight);
}
} catch (NumberFormatException e) {
Timber.e(e);
Expand Down

0 comments on commit 979e897

Please sign in to comment.