User:Seddon/wikicup.js

//Version 1 // Get the contents of the score column and put it into an array var colArray = new Array; $('.jquery-tablesorter tr td:nth-child(13)').each(function(i){colArray.push(parseInt($(this).text.replace('\n', '')));});

//sort the array colArray.sort(function(a, b){ return b-a;});

//What number is #64 and what array index is the last time it appears? var cutoff = 64; var cutoffPoints = colArray[cutoff-1]; var pointsThreshHolds = [20, 25, 30, 35, 40, 45, 50]

console.log('Current minimum score required to advance to Round 2:' ); console.log('-- ' + colArray[cutoff-1] + '  points --'); for (let i = 0; i < pointsThreshHolds.length; i++) { if(colArray.includes(pointsThreshHolds[i])){ var thresholdPlace = colArray.findLastIndex( (x) => x == pointsThreshHolds[i]) + 1; console.log(pointsThreshHolds[i] + ' points = #' + thresholdPlace) } }

//Version 2 additions //Find the nearest revision to 24 hours ago. //Fetch the content and repeat the above to show how thresholds have evolved. fetch('https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&continue=%7C%7C&titles=Wikipedia%3AWikiCup%2FHistory%2F2024&formatversion=2&rvprop=ids%7Ctimestamp&rvslots=&rvlimit=1&rvstart=2024-02-12T00%3A00%3A00.000Z&rvdir=older&rvcontinue=20240211201337%7C1206308628');