Skip to content

Commit

Permalink
Updates to account for 2024 JRDA statsbook and futureproof against no…
Browse files Browse the repository at this point in the history
…n-breaking updates to the file.
  • Loading branch information
AdamSmasherDerby committed Mar 9, 2024
1 parent e509941 commit 45156e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -169,4 +169,7 @@ Flamingo icon from http://www.iconsmind.com
* Added support for JRDA statsbook. Seems a good a reason as any for a new major version number.
* 3.1.0 - January 19, 2024
* Added ability to load statsbook from Google Sheets link.
* Corrected year of prior update in this README file.
* Corrected year of prior update in this README file.
* 3.1.1 - March 9, 2024
* Added support for JRDA 2024 statsbook.
* Theoretically will now default to the most recent current version if it encounters a NEWER version.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "statsbooktool",
"version": "3.1.0",
"version": "3.1.1",
"description": "A tool for error checking WFTDA Statsbooks",
"main": "main.js",
"author": "Adam Smasher (Daniel Alt) <dan@fnerk.com>",
Expand Down
12 changes: 10 additions & 2 deletions src/index.js
Expand Up @@ -234,7 +234,7 @@ let getVersion = (workbook) => {
// Determine version of Statsbook file.

let currentVersion = '2019'
let currentJRDAVersion = '2023jrda'
let currentJRDAVersion = '2024jrda'
let defaultVersion = '2018'
let sheet = workbook.Sheets['Read Me']
let versionText = (sheet ? sheet['A3'].v : defaultVersion)
Expand All @@ -245,6 +245,7 @@ let getVersion = (workbook) => {
}

switch (sbVersion){
case '2024jrda':
case '2023jrda':
sbTemplate = template2023jrda
currentVersion = currentJRDAVersion
Expand All @@ -261,11 +262,17 @@ let getVersion = (workbook) => {
}

// Warning check: outdated statsbook version
// Note that this will ALSO fire if the statsbook version is NEWER.
if (sbVersion != currentVersion){
sbErrors.warnings.oldStatsbookVersion.events.push(
`This File: ${sbVersion} Current Version: ${currentVersion} `
`This File: ${sbVersion} Current Supported Version: ${currentVersion} `
)
}

// Check for NEWER statsbook version
if (sbVersion > currentVersion){
sbVersion.includes('jrda') ? sbVersion = currentJRDAVersion : sbVersion = currentVersion
}
}

let readIGRF = (workbook) => {
Expand Down Expand Up @@ -1464,6 +1471,7 @@ let readLineups = (workbook) => {
break
case '2019':
case '2023jrda':
case '2024jrda':
// Possible codes - -, +, S, $, 3

// - - Enter box
Expand Down

0 comments on commit 45156e6

Please sign in to comment.