This commit is contained in:
Dominic Ferrando
2025-09-16 00:26:49 -04:00
parent 466f2095ba
commit 6dd0f9333c
2 changed files with 31 additions and 8 deletions
+12 -2
View File
@@ -28,14 +28,24 @@ export interface Metrics {
gender: Gender; gender: Gender;
}; };
type DataMetric = Extract<keyof Metrics, "age" | "weight">;
export interface Standard { export interface Standard {
metrics: Metrics; metrics: Metrics;
levels: Levels; levels: Levels;
} }
type StandardsGeneratorOptions = {
metric: DataMetric,
spread: number,
step: number,
ratio: "normal" | "inverse"
}
export type ActivityStandards = Record<Activity, { export type ActivityStandards = Record<Activity, {
metadata: { metadata: {
attribute: Attribute attribute: Attribute,
standardsGeneratorOptions: StandardsGeneratorOptions[]
}, },
standards: Standard[] standards: Standard[]
}>; }>;
@@ -269,7 +279,7 @@ export class Standards {
getOne: function() { getOne: function() {
return execMethods.getAll()[0]; return execMethods.getAll()[0];
}, },
getNearest(metric: "age" | "weight", target: number) { getNearest(metric: DataMetric, target: number) {
const standards = execMethods.getAll(); const standards = execMethods.getAll();
const lower = [...standards] const lower = [...standards]
.sort((a, b) => a.metrics[metric] - b.metrics[metric]) .sort((a, b) => a.metrics[metric] - b.metrics[metric])
+19 -6
View File
@@ -1,7 +1,8 @@
{ {
"BackSquat": { "BackSquat": {
"metadata": { "metadata": {
"attribute": "Strength" "attribute": "Strength",
"standardsGeneratorOptions": []
}, },
"standards": [ "standards": [
{ {
@@ -1576,7 +1577,8 @@
}, },
"Deadlift": { "Deadlift": {
"metadata": { "metadata": {
"attribute": "Strength" "attribute": "Strength",
"standardsGeneratorOptions": []
}, },
"standards": [ "standards": [
{ {
@@ -3151,7 +3153,8 @@
}, },
"BenchPress": { "BenchPress": {
"metadata": { "metadata": {
"attribute": "Strength" "attribute": "Strength",
"standardsGeneratorOptions": []
}, },
"standards": [ "standards": [
{ {
@@ -4726,7 +4729,15 @@
}, },
"Run": { "Run": {
"metadata": { "metadata": {
"attribute": "Endurance" "attribute": "Endurance",
"standardsGeneratorOptions": [
{
"metric": "weight",
"spread": 50,
"step": 12,
"ratio": "inverse"
}
]
}, },
"standards": [ "standards": [
{ {
@@ -5209,7 +5220,8 @@
}, },
"BroadJump": { "BroadJump": {
"metadata": { "metadata": {
"attribute": "Power" "attribute": "Power",
"standardsGeneratorOptions": []
}, },
"standards": [ "standards": [
{ {
@@ -5244,7 +5256,8 @@
}, },
"ConeDrill": { "ConeDrill": {
"metadata": { "metadata": {
"attribute": "Agility" "attribute": "Agility",
"standardsGeneratorOptions": []
}, },
"standards": [ "standards": [
{ {