Calculator UI simplification

This commit is contained in:
Dominic Ferrando
2026-07-04 02:50:59 -04:00
parent c1d3bed404
commit 448cabcb31
2 changed files with 13 additions and 78 deletions
+6 -6
View File
@@ -10,22 +10,22 @@ export class CalculatorService {
private cachedStandardsConfigData: string | null = null;
private lastRefreshedAt = 0;
private levelCalculator: LevelCalculator;
private calculator: LevelCalculator;
constructor() {
this.levelCalculator = new LevelCalculator(new Standards(DEFAULT_STANDARDS_DATA));
this.calculator = new LevelCalculator(new Standards(DEFAULT_STANDARDS_DATA));
}
calculate(player: Player, activityPerformances: ActivityPerformance[]) {
this.refreshConfig({ onlyIfStale: true }).catch((err) => log.error({ err }, "failed to refresh calculator config"));
return this.levelCalculator.calculate(player, activityPerformances);
return this.calculator.calculate(player, activityPerformances);
}
async getSelectedConfig(opt: { skipCache?: boolean } = {}): Promise<StandardsConfig> {
if (!opt.skipCache) return this.levelCalculator.standards.cfg;
if (!opt.skipCache) return this.calculator.standards.cfg;
await this.refreshConfig();
return this.levelCalculator.standards.cfg;
return this.calculator.standards.cfg;
}
async selectConfig(id: string) {
@@ -72,7 +72,7 @@ export class CalculatorService {
const standardsConfigData = JSON.stringify(result.standards_config);
if (standardsConfigData === this.cachedStandardsConfigData) return;
this.levelCalculator = new LevelCalculator(new Standards(DEFAULT_STANDARDS_DATA, result.standards_config));
this.calculator = new LevelCalculator(new Standards(DEFAULT_STANDARDS_DATA, result.standards_config));
this.cachedStandardsConfigData = standardsConfigData;
}
}