Standards levelign fix
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Standards,
|
||||
type ActivityStandards,
|
||||
type Metrics,
|
||||
type Standard,
|
||||
type StandardsConfig,
|
||||
} from "$lib/services/calculator/main";
|
||||
import allStandardsRaw from "$lib/data/standards.json" assert { type: "json" };
|
||||
import {
|
||||
Activity,
|
||||
cmToIn,
|
||||
@@ -26,17 +24,6 @@
|
||||
|
||||
const { selected, allStandards }: Props = $props();
|
||||
|
||||
const allAnchorStandards = $derived.by(() => {
|
||||
const standardsCfg = structuredClone(selected.cfg);
|
||||
for (const activityCfg of Object.values(standardsCfg.activity)) {
|
||||
activityCfg.disableGeneration = true;
|
||||
}
|
||||
return new Standards(
|
||||
allStandardsRaw as ActivityStandards,
|
||||
standardsCfg,
|
||||
);
|
||||
});
|
||||
|
||||
const getLvlValue = (
|
||||
activity: Activity,
|
||||
standard: Standard,
|
||||
@@ -46,7 +33,8 @@
|
||||
const unit = allStandards.byActivity(activity).getMetadata().unit;
|
||||
switch (unit) {
|
||||
case "ms":
|
||||
return msToTime(rawValue, activity === Activity.ConeDrill);
|
||||
const seconds = (rawValue / 1000).toFixed(1);
|
||||
return `${seconds}`;
|
||||
case "cm": {
|
||||
const totalInches = cmToIn(rawValue);
|
||||
const feet = Math.floor(totalInches / 12);
|
||||
@@ -65,7 +53,7 @@
|
||||
<div>
|
||||
<div class="flex items-center">
|
||||
<p class="text-xs label">
|
||||
{#if !selected.cfg.activity[selected.activity].disableGeneration && allStandards
|
||||
{#if selected.cfg.activity[selected.activity].enableGeneration && allStandards
|
||||
.byActivity(selected.activity)
|
||||
.getMetadata().generators.length}
|
||||
(Generated data: {allStandards
|
||||
|
||||
@@ -5294,7 +5294,7 @@
|
||||
"2": 8700,
|
||||
"3": 7800,
|
||||
"4": 7000,
|
||||
"5": 6500
|
||||
"5": 6000
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -5308,7 +5308,7 @@
|
||||
"2": 9600,
|
||||
"3": 8700,
|
||||
"4": 7800,
|
||||
"5": 7200
|
||||
"5": 6700
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,10 +5,10 @@ import { Activity, Attribute, Gender, getAvgWeight, kgToLb, lbToKg, type Activit
|
||||
// http://lonkilgore.com/resources/Lon_Kilgore_Strength_Standard_Tables-Copyright-2023.pdf
|
||||
// 1 mile run:
|
||||
// https://runninglevel.com/running-times/1-mile-times
|
||||
// Dash:
|
||||
// https://marathonhandbook.com/average-100-meter-time/
|
||||
// Broad Jump:
|
||||
// https://nrpt.co.uk/training/tests/power/broad.htm
|
||||
// 3 Cone drill:
|
||||
// https://nflsavant.com/combine.php?utm_source=chatgpt.com
|
||||
|
||||
export type LevelCalculatorOutput = {
|
||||
player: number,
|
||||
@@ -213,11 +213,17 @@ export class Standards {
|
||||
// prepare data
|
||||
this.activityStandards = structuredClone(activityStandards);
|
||||
for (const activity of Object.keys(this.activityStandards) as Activity[]) {
|
||||
// expand/compress
|
||||
for (const standard of this.activityStandards[activity].standards) {
|
||||
const expandedLevels = this.expandLevels(standard.levels, 5);
|
||||
const compressedLevels = this.compressLevels(expandedLevels, this.cfg.global.maxLevel);
|
||||
standard.levels = compressedLevels;
|
||||
// expand
|
||||
let i = 1;
|
||||
while (Object.keys(standard.levels).length < this.cfg.global.maxLevel) {
|
||||
standard.levels = this.expandLevels(standard.levels, i++);
|
||||
}
|
||||
|
||||
// compress
|
||||
if (Object.keys(standard.levels).length > this.cfg.global.maxLevel) {
|
||||
standard.levels = this.compressLevels(standard.levels, this.cfg.global.maxLevel);
|
||||
}
|
||||
|
||||
// apply skew config
|
||||
for (const level in standard.levels) {
|
||||
|
||||
Reference in New Issue
Block a user