Skip to content

Commit

Permalink
Untested points grabber
Browse files Browse the repository at this point in the history
  • Loading branch information
gazhay committed Dec 9, 2023
1 parent 0023065 commit b027cf7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pages/src/mod.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const SERVER = (DEBUG!="")?"http://arwen.lan:5000":"https://ladder.cyclerac

var INTERESTEDIN = [];

const scoreForPos = pos=>[12,10,8,7,6,5,4,3,2,1][pos-1]??0;
var scoreForPos = pos=>[12,10,8,7,6,5,4,3,2,1][pos-1]??0;

var tops = Array.from(Array(12).keys()).map( (a,i)=>( 10+ (45*(i-1)) ));
let riderCache = [];

Expand Down Expand Up @@ -40,6 +41,13 @@ async function fetchFromLadder(){
}
myLadderData = myLadderData?.[0] || [];

// Now we have to get the points structure for ladder matches
await fetch(`${SERVER}/api/pointsStructure`).then(response=>response.json()).then(scores=>{
if (scores && scores?.length>0){
scoreForPos = pos=>[...scores][pos-1]??0;
}
}).catch(err=>{console.log("Failed to fetch points",err)});

let oldInterests = INTERESTEDIN;
INTERESTEDIN = [...JSON.parse(myLadderData?.homeSignups),...JSON.parse(myLadderData?.awaySignups)];
console.log("Found riders from ladder :", INTERESTEDIN, myLadderData);
Expand Down

0 comments on commit b027cf7

Please sign in to comment.