Opening a habit's statistics aborted the app when checked-in sessions had no before-mood, energy, or stress rating, because the averages divided by a zero count. Averages now skip empty groups and keep their fraction instead of truncating to whole numbers. The habit edit button and the sync review dialog showed raw locale keys; they are now translated in every locale, along with the sync review message, and a test checks that every key the app uses exists in every locale. Habit statistics and calendar screenshot scenes now select a habit so they show those views.
15 lines
522 B
Ziran
15 lines
522 B
Ziran
#import, file "../src/storage/mood_average.zi";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
// Sessions rated after practice but never before: no lift to average.
|
|
if SessionMoodAverage(0, 0) != 0.0 { return 0 }
|
|
if SessionMoodAverage(12, 0) != 0.0 { return 0 }
|
|
// 4 + 5 + 5 over three sessions keeps its fraction.
|
|
average := SessionMoodAverage(14, 3)
|
|
if average < 4.66 || average > 4.67 { return 0 }
|
|
// Mood lift can be negative.
|
|
if SessionMoodAverage(-3, 2) != -1.5 { return 0 }
|
|
return 42
|
|
}
|