Skip to content

Commit

Permalink
refactor: change circuit type computation for open distance
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingtof committed Sep 5, 2024
1 parent 1b6e884 commit e9693e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions apps/fxc-front/src/app/components/2d/path-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,11 @@ export class PathElement extends connect(store)(LitElement) {
let circuit = '';
if (scoringResult.lengthKm !== 0 && window.parent) {
kms = scoringResult.lengthKm.toFixed(1);
circuit = CIRCUIT_SHORT_NAME[scoringResult.circuit];
if (scoringResult.circuit === CircuitType.OpenDistance) {
circuit += scoringResult.solutionIndices.length - 2;
}
// add number of turn points for an open distance
circuit =
scoringResult.circuit === CircuitType.OpenDistance
? CIRCUIT_SHORT_NAME[scoringResult.circuit] + scoringResult.turnpoints.length
: CIRCUIT_SHORT_NAME[scoringResult.circuit];
window.parent.postMessage(
JSON.stringify({
kms,
Expand Down
2 changes: 1 addition & 1 deletion apps/fxc-front/src/app/logic/score/scorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Scorer {
// lazy creation of the worker
this.scoringWorker ??= this.createWorker();
// stores the handler for retrieval when handling worker response message
const id = this.currentScoringRequestId++;
const id = ++this.currentScoringRequestId;
this.handlers.set(id, handleScoringResult);
try {
this.scoringWorker.postMessage({
Expand Down

0 comments on commit e9693e5

Please sign in to comment.