From: Steinar H. Gunderson Date: Sat, 12 Oct 2019 12:33:23 +0000 (+0200) Subject: Some parametrization and Trøndisk updates of the spreadsheets. X-Git-Url: https://git.sesse.net/?p=ultimatescore;a=commitdiff_plain;h=293056153fd82b7acf0147a0c81b29423347b23a Some parametrization and Trøndisk updates of the spreadsheets. --- diff --git a/config.js b/config.js index eab21b0..ecc59ee 100644 --- a/config.js +++ b/config.js @@ -1,11 +1,21 @@ var ultimateconfig = { - 'tournament_title': 'Battle of Oak Hill 2019', - 'tournament_footer': 'ekebergsk.com | #us4', - 'exohack': true, + 'tournament_title': 'Trøndisk 2019', + 'tournament_footer': 'plastkast.no | #trøndisk', + 'exohack': false, // Share both sheets with ultimate-nm-2018@solskogen-cubemap.iam.gserviceaccount.com. - 'score_sheet_id': '1DSRRcV6d6Dx9KbCZgOSFF0MX9wKRex9nHcUjjOG4DNE', - 'roster_sheet_id': '1Mp6sWSxxvRl3YCCx4-RPlnCyuzkgNbJW1iCHnsH-9Ks', + 'score_sheet_id': '16TOrQX-oOhuxSA478iE8h3l3CD72GyEqVsChZptayxo', + 'roster_sheet_id': '1ACCrWaicEOFbeoY05SCbCvk2cHF6yAS9WwFOdNJxMIU', + 'api_key': 'AIzaSyAuP9yQn8g0bSay6r_RpGtpFeIbwprH1TU', - 'api_key': 'AIzaSyAuP9yQn8g0bSay6r_RpGtpFeIbwprH1TU' + // Rank, name, points. + 'score_sheet_cols': { + 'Group A': [ 'Results!S', 'Results!T', 'Results!U' ], + 'Group B': [ 'Results!W', 'Results!X', 'Results!Y' ], + 'Group C': [ 'Results!AA', 'Results!AB', 'Results!AC' ] + }, + + 'point_total_start_row': 10, + 'ranking_list_start_row': 19, + 'ranking_list_explain_row': 25 }; diff --git a/update_sheets.js b/update_sheets.js index e1df3a0..2115b8c 100644 --- a/update_sheets.js +++ b/update_sheets.js @@ -69,10 +69,7 @@ function publish_group_rank(group_name) { get_group(group_name, function(response, group_name) { let updates = []; - let cols = ["Results!M", "Results!N", "Results!O"]; - if (group_name === 'Group B') { - cols = ["Results!Q", "Results!R", "Results!S"]; - } + let cols = ultimateconfig['score_sheet_cols'][group_name]; let teams = parse_teams_from_spreadsheet(response); let games = parse_games_from_spreadsheet(response, group_name, false); @@ -80,7 +77,8 @@ function publish_group_rank(group_name) // Write the points total to the unsorted columns. for (let i = 0; i < teams.length; ++i) { - updates.push({ "range": cols[2] + (10 + i), "values": [ [ teams[i].pts ] ] }); + let row = ultimateconfig['point_total_start_row'] + i; + updates.push({ "range": cols[2] + row, "values": [ [ teams[i].pts ] ] }); } let tiebreakers = []; @@ -88,16 +86,17 @@ function publish_group_rank(group_name) // Write the ranking table, from scratch. for (let i = 0; i < teams.length; ++i) { - updates.push({ "range": cols[0] + (19 + i), "values": [ [ teams[i].rank ] ] }); - updates.push({ "range": cols[1] + (19 + i), "values": [ [ teams[i].shortname ] ] }); - updates.push({ "range": cols[2] + (19 + i), "values": [ [ teams[i].pts ] ] }); + let row = ultimateconfig['ranking_list_start_row'] + i; + updates.push({ "range": cols[0] + row, "values": [ [ teams[i].rank ] ] }); + updates.push({ "range": cols[1] + row, "values": [ [ teams[i].shortname ] ] }); + updates.push({ "range": cols[2] + row, "values": [ [ teams[i].pts ] ] }); } let tb_str = ""; if (tiebreakers.length != 0) { tb_str = tiebreakers.join("\n"); } - updates.push({ "range": cols[0] + "25", "values": [ [ tb_str ] ]}); + updates.push({ "range": cols[0] + ultimateconfig['ranking_list_explain_row'], "values": [ [ tb_str ] ]}); let json = { "valueInputOption": "USER_ENTERED",