Remove standards config fallback and implement caching
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"global": {
|
||||
"maxLevel": 100
|
||||
},
|
||||
"activity": {
|
||||
"BackSquat": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": 0,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": 0,
|
||||
"difficultyModifier": 0.3,
|
||||
"peakAge": 0,
|
||||
"stretch": {
|
||||
"upper": 0,
|
||||
"lower": 1
|
||||
}
|
||||
},
|
||||
"BenchPress": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": 0,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": 0,
|
||||
"difficultyModifier": 0.05,
|
||||
"peakAge": 0,
|
||||
"stretch": {
|
||||
"upper": 1,
|
||||
"lower": 0
|
||||
}
|
||||
},
|
||||
"Deadlift": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": 0,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": 0,
|
||||
"difficultyModifier": -0.05,
|
||||
"peakAge": 0,
|
||||
"stretch": {
|
||||
"upper": 1,
|
||||
"lower": 0
|
||||
}
|
||||
},
|
||||
"Run": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": 0.1,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": 0,
|
||||
"difficultyModifier": 0.35,
|
||||
"peakAge": 0,
|
||||
"stretch": {
|
||||
"upper": 1,
|
||||
"lower": 1
|
||||
}
|
||||
},
|
||||
"BroadJump": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": -0.1,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": -0.25,
|
||||
"difficultyModifier": -0.15,
|
||||
"peakAge": 23,
|
||||
"stretch": {
|
||||
"upper": 3,
|
||||
"lower": 1
|
||||
}
|
||||
},
|
||||
"ConeDrill": {
|
||||
"enableGeneration": true,
|
||||
"weightModifier": -0.1,
|
||||
"weightSkew": 0,
|
||||
"ageModifier": -0.25,
|
||||
"difficultyModifier": 0.15,
|
||||
"peakAge": 23,
|
||||
"stretch": {
|
||||
"upper": 0,
|
||||
"lower": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,8 @@ import {
|
||||
type Player,
|
||||
} from "@blade-and-brawn/domain";
|
||||
import { levenbergMarquardt as LM } from "ml-levenberg-marquardt";
|
||||
import defaultStandardsParamsJson from "./data/standards/fallback-params.json" with { type: "json" };
|
||||
import defaultStandardsDataJson from "./data/standards/fallback-data.json" with { type: "json" };
|
||||
import { getAvgWeight } from "./avg-weights";
|
||||
import { StandardsDataSchema, StandardsParamsSchema, type LevelCalculatorOutput, type Levels, type NumberMetric, type Standard, type StandardsConfig, type StandardsData } from "./models";
|
||||
import { Value } from "@sinclair/typebox/value";
|
||||
import { type LevelCalculatorOutput, type Levels, type NumberMetric, type Standard, type StandardsConfig, type StandardsData } from "./models";
|
||||
|
||||
// SOURCES
|
||||
// Squat, Bench, Dead Lift:
|
||||
@@ -34,13 +31,6 @@ const metricPriority = (m: NumberMetric) => {
|
||||
return 2;
|
||||
};
|
||||
|
||||
Value.Assert(StandardsDataSchema, defaultStandardsDataJson);
|
||||
Value.Assert(StandardsParamsSchema, defaultStandardsParamsJson);
|
||||
export const FALLBACK_STANDARDS_CONFIG: StandardsConfig = {
|
||||
data: defaultStandardsDataJson,
|
||||
params: defaultStandardsParamsJson
|
||||
};
|
||||
|
||||
export class LevelCalculator {
|
||||
Standards: Standards;
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ type Credentials = {
|
||||
export class PrintfulError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public status: number,
|
||||
public upstreamStatus: number,
|
||||
public payload: unknown,
|
||||
public status: number = 502
|
||||
) {
|
||||
super(message);
|
||||
this.name = "PrintfulError";
|
||||
|
||||
@@ -22,8 +22,9 @@ type Credentials = {
|
||||
export class WebflowError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public status: number,
|
||||
public upstreamStatus: number,
|
||||
public payload: unknown,
|
||||
public status: number = 502
|
||||
) {
|
||||
super(message);
|
||||
this.name = "WebflowError";
|
||||
|
||||
Reference in New Issue
Block a user