adjust dashboard berat page to match dashboard-cpsp
This commit is contained in:
1 parent
c71dcc188b
commit
236c83ec3d
2 files changed
+21
-27
No files matched your search
+7
-1
@@ -61,6 +61,7 @@ function pickStandardValues(docWeight: number): number[] {
|
||||
|
||||
/** Target body weight (grams) for a given age from the Ross 308 DOC-weight table. */
|
||||
export function getTargetWeightForAge(age: number, docWeight: number): number | null {
|
||||
if (age === 0) return docWeight > 0 ? docWeight : null;
|
||||
const values = pickStandardValues(docWeight);
|
||||
if (age < 1 || age > values.length) return null;
|
||||
return values[age - 1] ?? null;
|
||||
@@ -69,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;
|
||||
|
||||
Reference in new issue
Block a user