fix day 1 target weight bug and chicken counting row not showed before publish cutoff

This commit is contained in:
Alberto-Audrix committed 2026-10-02 10:47:00 +07:00
1 parent 05465b0382
commit 3fe6b05258
5 files changed
+28 -11

No files matched your search

+6 -1
View File
@@ -70,7 +70,12 @@ export function getTargetWeightForAge(age: number, docWeight: number): number |
/** Target daily weight gain (grams/day) for a given age from the standard. */
export function getTargetGainForAge(age: number, docWeight: number): number | null {
const values = pickStandardValues(docWeight);
if (age < 2 || age > values.length) return null;
if (age < 1 || age > values.length) return null;
if (age === 1) {
const current = values[0];
if (current == null || docWeight <= 0) return null;
return current - docWeight;
}
const current = values[age - 1];
const previous = values[age - 2];
if (current == null || previous == null) return null;