From 934b974d1062ba72d3cd5a71142e821473d1fb48 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 10 Oct 2022 19:59:25 -0600 Subject: [PATCH] Add feisresults, almost complete --- .../dataset.mjs | 5 ++- .../{guidebook.mjs => feisresults.mjs} | 35 +++++++++++++++---- 2 files changed, 31 insertions(+), 9 deletions(-) rename content/blog/2022-10-10-CLRG-Results-Analysis/{guidebook.mjs => feisresults.mjs} (76%) diff --git a/content/blog/2022-10-10-CLRG-Results-Analysis/dataset.mjs b/content/blog/2022-10-10-CLRG-Results-Analysis/dataset.mjs index 5e70c3f..d1bdba3 100644 --- a/content/blog/2022-10-10-CLRG-Results-Analysis/dataset.mjs +++ b/content/blog/2022-10-10-CLRG-Results-Analysis/dataset.mjs @@ -3,7 +3,7 @@ */ import * as FeisWorx from "./feisworx.mjs" -import * as Guidebook from "./guidebook.mjs" +import * as FeisResults from "./feisresults.mjs" /** * @typedef {import("./types.mjs").Results} Results @@ -90,7 +90,7 @@ function parseRawData(rawData) { return FeisWorx.parse(rawData) } if (firstRow[firstRow.length-1].trim().toLowerCase() == "total ip *") { - return Guidebook.parse(rawData) + return FeisResults.parse(rawData) } console.error("First row doesn't resemble anything I can cope with", firstRow) } @@ -163,7 +163,6 @@ async function init() { let table = newElement(div, "table") fillTable(table, results) - console.log(results) } } diff --git a/content/blog/2022-10-10-CLRG-Results-Analysis/guidebook.mjs b/content/blog/2022-10-10-CLRG-Results-Analysis/feisresults.mjs similarity index 76% rename from content/blog/2022-10-10-CLRG-Results-Analysis/guidebook.mjs rename to content/blog/2022-10-10-CLRG-Results-Analysis/feisresults.mjs index 2bf8e78..f1132b6 100644 --- a/content/blog/2022-10-10-CLRG-Results-Analysis/guidebook.mjs +++ b/content/blog/2022-10-10-CLRG-Results-Analysis/feisresults.mjs @@ -1,10 +1,6 @@ /** - * Guidebook parser + * Feisresults.com parser * - * We're not actually sure what generated these PDFs. - * But we got them from Guidebook, so there you go. - * - * This is the output of Adobe Reader saving the PDF as XML. */ import {awardPoints, guessPlacing} from "./awardPoints.mjs" @@ -18,7 +14,7 @@ import {awardPoints, guessPlacing} from "./awardPoints.mjs" /** - * Parse Guidebook data + * Parse feisresults data * * @param {Array.>} rawData Raw data * @returns {Results} @@ -107,7 +103,34 @@ import {awardPoints, guessPlacing} from "./awardPoints.mjs" } results.push(row) } + + disambiguatePlacings(results, numRounds, adjudicatorsPerRound) return results +} + +function disambiguatePlacings(results, numRounds, adjudicatorsPerRound) { + for (let roundNumber = 0; roundNumber < numRounds; roundNumber++) { + /** + * A list of raw score, award points, and placing + * + * @type {Array.} + */ + for (let judgeNumber = 0; judgeNumber < adjudicatorsPerRound; judgeNumber++) { + let scores = [] + for (let result of results) { + scores.push(result.rounds[roundNumber][judgeNumber]) + } + scores.sort((a,b) => b.raw - a.raw) + + let greatestPlacing = 0 + for (let adjudication of scores) { + let possibilities = guessPlacing(adjudication.points) + possibilities.sort((a,b) => b-a) + // XXX: eliminate possibilities less than greatestPlacing, then pick the largest + } + console.log(scores) + } + } } export {