From ce7428dc5328cd024d2e768cc2f1f23b296d86e2 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Thu, 4 Aug 2022 22:16:03 +0200 Subject: [PATCH 1/9] Don't reset ruleset during start new game --- src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java index 68540d469..ce8b133d2 100644 --- a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java @@ -122,8 +122,6 @@ private void initReferences(Ruleset rs) { snapshot = null; replacePending = false; - setRuleset(scoreBoard.getRulesets().getRuleset(Rulesets.ROOT_ID)); - setLabel(Button.START, ACTION_START_JAM); setLabel(Button.STOP, ACTION_LINEUP); setLabel(Button.TIMEOUT, ACTION_TIMEOUT); From 0f0b9ca9bb2c0c57571e4ed9b910ba63f36fcbed Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Thu, 4 Aug 2022 22:16:40 +0200 Subject: [PATCH 2/9] write PBT names into statsbook if known --- .../scoreboard/utils/StatsbookExporter.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java b/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java index 3ebccaf40..1b6bd1a4f 100644 --- a/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java +++ b/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java @@ -136,10 +136,12 @@ private void fillIgrfAndPenalties() { Sheet penalties = wb.getSheet("Penalties"); Sheet clock = wb.getSheet("Game Clock"); + Sheet box = wb.getSheet("Penalty Box"); fillTeamData(igrf, clock, Team.ID_1); fillTeamData(igrf, clock, Team.ID_2); fillPenaltiesHead(penalties); + fillBoxHead(box); for (Team t : game.getAll(Game.TEAM)) { List skaters = new ArrayList<>(t.getAll(Team.SKATER)); @@ -251,6 +253,12 @@ public int compare(Official o1, Official o2) { lt[1][o.get(Official.SWAP) ? 1 - tId : tId] = name; } break; + case Official.ROLE_PBT: + if (tId >= 0) { + pbt[0][tId] = name; + pbt[1][o.get(Official.SWAP) ? 1 - tId : tId] = name; + } + break; default: break; } @@ -311,6 +319,15 @@ private void fillPenaltiesHead(Sheet penalties) { setCell(row, 41, pt); } + private void fillBoxHead(Sheet box) { + Row row = box.getRow(0); + setCell(row, 11, pbt[0][0]); + setCell(row, 28, pbt[0][1]); + row = box.getRow(43); + setCell(row, 11, pbt[1][0]); + setCell(row, 28, pbt[1][1]); + } + private void fillSkater(Row row, Skater s, Sheet clock) { String teamId = s.getTeam().getProviderId(); String flags = s.getFlags(); @@ -676,6 +693,7 @@ private void createCellStyles(Sheet igrf) { private String[][] sk = {{"", ""}, {"", ""}}; private String[][] jr = {{"", ""}, {"", ""}}; private String[][] lt = {{"", ""}, {"", ""}}; + private String[][] pbt = {{"", ""}, {"", ""}}; private List injuries; From 567099851cf5dbfe6f6635c42fc258bb6be59480 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Mon, 8 Aug 2022 16:52:20 +0200 Subject: [PATCH 3/9] Fix captin indicator not showing consistently --- html/components/plt-input.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/html/components/plt-input.js b/html/components/plt-input.js index b7d0eb518..e0fc3e16b 100755 --- a/html/components/plt-input.js +++ b/html/components/plt-input.js @@ -356,6 +356,8 @@ function preparePltInputTable(element, gameId, teamId, mode, statsbookPeriod, al var p = $('').addClass('Skater Penalty').attr('id', id).attr('number', number).attr('role', role); var j = $('').addClass('Skater Jam').attr('id', id); + p.toggleClass('Captain', WS.state['ScoreBoard.Game(' + gameId + ').Team(' + t + ').Skater(' + id + ').Flags'] === 'C'); + if (mode === 'lt' || mode === 'plt') { var benchCell = $('') .addClass('Role Bench') From c2568186da95d6c4e91a05ba9417f371ea59cc60 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Mon, 8 Aug 2022 19:55:07 +0200 Subject: [PATCH 4/9] Filter special characters when generating filename --- .../carolinarollergirls/scoreboard/core/game/GameImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java index ce8b133d2..998b8279a 100644 --- a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java @@ -243,8 +243,8 @@ protected Object computeValue(Value prop, Object value, Object last, Source s return source.isFile() ? value : last; } String date = get(EVENT_INFO, INFO_DATE) == null ? "0000-00-00" : get(EVENT_INFO, INFO_DATE).getValue(); - String team1 = getTeam(Team.ID_1).get(Team.FILE_NAME).replace(" ", ""); - String team2 = getTeam(Team.ID_2).get(Team.FILE_NAME).replace(" ", ""); + String team1 = getTeam(Team.ID_1).get(Team.FILE_NAME).replaceAll("\\W+", ""); + String team2 = getTeam(Team.ID_2).get(Team.FILE_NAME).replaceAll("\\W+", ""); String newName = "STATS-" + date + "_" + team1 + "_vs_" + team2; if (newName.equals(last)) { return newName; From 0d1cd4bbd56c1ebb958be2b98e1f15f1bcf7ae6a Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Mon, 8 Aug 2022 20:37:10 +0200 Subject: [PATCH 5/9] fix clearing annotations also eliminate annotation indicators showing up after removing a trip --- html/components/lt-sheet.js | 2 +- html/components/sk-sheet.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/html/components/lt-sheet.js b/html/components/lt-sheet.js index 77710b0ba..a3975d811 100644 --- a/html/components/lt-sheet.js +++ b/html/components/lt-sheet.js @@ -82,7 +82,7 @@ function prepareLtSheetTable(element, gameId, teamId, mode) { } else if (k.field === 'CurrentBoxSymbols') { element.find('#upcoming .Box.Box' + k.Position).text(v); } else if (k.field === 'Annotation') { - element.find('#upcoming .Skater.' + k.Position).toggleClass('hasAnnotation', v !== ''); + element.find('#upcoming .Skater.' + k.Position).toggleClass('hasAnnotation', v != null && v !== ''); } } ); diff --git a/html/components/sk-sheet.js b/html/components/sk-sheet.js index 03c16802e..5a0a61cef 100644 --- a/html/components/sk-sheet.js +++ b/html/components/sk-sheet.js @@ -187,11 +187,11 @@ function prepareSkSheetTable(element, gameId, teamId, mode) { case 'NoInitial': var trip1Score = WS.state[prefix + 'ScoringTrip(1).Score']; var trip1AfterSP = isTrue(WS.state[prefix + 'ScoringTrip(1).AfterSP']); - var trip1HasAnnotation = WS.state[prefix + 'ScoringTrip(1).Annotation'] !== ''; + var trip1HasAnnotation = (WS.state[prefix + 'ScoringTrip(1).Annotation'] || '') !== ''; var trip2Score = WS.state[prefix + 'ScoringTrip(2).Score']; var trip2Current = isTrue(WS.state[prefix + 'ScoringTrip(2).Current']); var trip2AfterSP = isTrue(WS.state[prefix + 'ScoringTrip(2).AfterSP']); - var trip2HasAnnotation = trip2Score != null && WS.state[prefix + 'ScoringTrip(2).Annotation'] !== ''; + var trip2HasAnnotation = trip2Score != null && (WS.state[prefix + 'ScoringTrip(2).Annotation'] || '') !== ''; var noInitial = isTrue(WS.state[prefix + 'NoInitial']); var scoreText = ''; var otherScoreText = ''; @@ -235,7 +235,7 @@ function prepareSkSheetTable(element, gameId, teamId, mode) { } var score = WS.state[prefix + 'ScoringTrip(' + trip + ').Score']; var current = isTrue(WS.state[prefix + 'ScoringTrip(' + trip + ').Current']); - var hasAnnotation = WS.state[prefix + 'ScoringTrip(' + trip + ').Annotation'] !== ''; + var hasAnnotation = (WS.state[prefix + 'ScoringTrip(' + trip + ').Annotation'] || '') !== ''; row .find('.Trip' + trip) .toggleClass('hasAnnotation', hasAnnotation) @@ -257,10 +257,10 @@ function prepareSkSheetTable(element, gameId, teamId, mode) { } if (isTrue(WS.state[prefix + 'ScoringTrip(' + t + ').AfterSP'])) { scoreAfterSP = scoreAfterSP === '' ? tripScore : scoreAfterSP + ' + ' + tripScore; - annotationAfterSP = annotationAfterSP || WS.state[prefix + 'ScoringTrip(' + t + ').Annotation'] !== ''; + annotationAfterSP = annotationAfterSP || (WS.state[prefix + 'ScoringTrip(' + t + ').Annotation'] || '') !== ''; } else { scoreBeforeSP = scoreBeforeSP === '' ? tripScore : scoreBeforeSP + ' + ' + tripScore; - annotationBeforeSP = annotationBeforeSP || WS.state[prefix + 'ScoringTrip(' + t + ').Annotation'] !== ''; + annotationBeforeSP = annotationBeforeSP || (WS.state[prefix + 'ScoringTrip(' + t + ').Annotation'] || '') !== ''; } t++; } @@ -507,6 +507,7 @@ function prepareTripEditor() { .button() .on('click', function () { tripEditor.find('#annotation').val(''); + WS.Set(tripEditor.data('prefix') + 'Annotation', ''); }) ) ) From 2bd9b632346ef02191c8c702814373b03d28b6c3 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Mon, 8 Aug 2022 21:03:54 +0200 Subject: [PATCH 6/9] Don't fail statsbook export when parsing date or time fails --- .../scoreboard/utils/StatsbookExporter.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java b/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java index 1b6bd1a4f..7b2437961 100644 --- a/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java +++ b/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java @@ -177,14 +177,12 @@ private void fillIgrfHead(Sheet igrf) { setEventInfoCell(row, 1, Game.INFO_TOURNAMENT); setEventInfoCell(row, 8, Game.INFO_HOST); row = igrf.getRow(6); - if (game.get(Game.EVENT_INFO, Game.INFO_DATE) != null) { + try { LocalDate date = LocalDate.parse(game.get(Game.EVENT_INFO, Game.INFO_DATE).getValue()); row.getCell(1).setCellValue(date); - if (game.get(Game.EVENT_INFO, Game.INFO_START_TIME) != null) { - LocalTime time = LocalTime.parse(game.get(Game.EVENT_INFO, Game.INFO_START_TIME).getValue()); - row.getCell(8).setCellValue(LocalDateTime.of(date, time)); - } - } + LocalTime time = LocalTime.parse(game.get(Game.EVENT_INFO, Game.INFO_START_TIME).getValue()); + row.getCell(8).setCellValue(LocalDateTime.of(date, time)); + } catch (Exception e) {} // when parsing fails just leave them empty } private void fillExpulsionSuspensionInfo(Sheet igrf) { From a1f9c893fab40df82aed6f620b62939bf21bdfed Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Tue, 9 Aug 2022 15:57:53 +0200 Subject: [PATCH 7/9] handle non-parsable start time more gracefully --- .../core/current/CurrentGameImpl.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/com/carolinarollergirls/scoreboard/core/current/CurrentGameImpl.java b/src/com/carolinarollergirls/scoreboard/core/current/CurrentGameImpl.java index 46726ccfa..6144724dc 100644 --- a/src/com/carolinarollergirls/scoreboard/core/current/CurrentGameImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/current/CurrentGameImpl.java @@ -85,17 +85,19 @@ protected void valueChanged(Value prop, Object value, Object last, Source sou Game g = (Game) value; if (g.get(Game.EVENT_INFO, Game.INFO_START_TIME) != null && !"".equals(g.get(Game.EVENT_INFO, Game.INFO_START_TIME).getValue())) { - LocalTime time = LocalTime.parse(g.get(Game.EVENT_INFO, Game.INFO_START_TIME).getValue()); - LocalDate date = "".equals(g.get(Game.EVENT_INFO, Game.INFO_DATE).getValue()) - ? LocalDate.now() - : LocalDate.parse(g.get(Game.EVENT_INFO, Game.INFO_DATE).getValue()); - long timeToStart = ChronoUnit.MILLIS.between(LocalDateTime.now(), LocalDateTime.of(date, time)); - if (timeToStart > 0) { - Clock ic = g.getClock(Clock.ID_INTERMISSION); - ic.setMaximumTime(timeToStart); - ic.resetTime(); - ic.start(); - } + try { + LocalTime time = LocalTime.parse(g.get(Game.EVENT_INFO, Game.INFO_START_TIME).getValue()); + LocalDate date = "".equals(g.get(Game.EVENT_INFO, Game.INFO_DATE).getValue()) + ? LocalDate.now() + : LocalDate.parse(g.get(Game.EVENT_INFO, Game.INFO_DATE).getValue()); + long timeToStart = ChronoUnit.MILLIS.between(LocalDateTime.now(), LocalDateTime.of(date, time)); + if (timeToStart > 0) { + Clock ic = g.getClock(Clock.ID_INTERMISSION); + ic.setMaximumTime(timeToStart); + ic.resetTime(); + ic.start(); + } + } catch (Exception e) {} // if parsing fails just set no time to derby } } } From d169b8d7abf2eac58c6a121e37ae054168040751 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Tue, 9 Aug 2022 16:48:32 +0200 Subject: [PATCH 8/9] Fix jam number dropdown in timeout popup --- html/components/team-time-tab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html/components/team-time-tab.js b/html/components/team-time-tab.js index 9772bb2a7..8dbdbfc24 100644 --- a/html/components/team-time-tab.js +++ b/html/components/team-time-tab.js @@ -1600,12 +1600,13 @@ function createTimeoutDialog(gameId) { row.remove(); return; } - if (k.field === 'PrecedingJamNumber') { + if (k.field === 'PrecedingJam') { row.remove(); row = []; } if (v != null && row.length === 0) { var jam = Number(WS.state[prefix + '.PrecedingJamNumber']); + processJamNumber(k, jam); var dur = isTrue(WS.state[prefix + '.Running']) ? 'Running' : _timeConversions.msToMinSec(WS.state[prefix + '.Duration'], true); var pc = _timeConversions.msToMinSec( isTrue(WS.state[prefix + '.Running']) From e23a3b0fade881fee6167699f5158bee4c43a03c Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Fri, 12 Aug 2022 18:05:04 +0200 Subject: [PATCH 9/9] Apply operator colors when name is uniform color --- html/components/team-time-tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/components/team-time-tab.js b/html/components/team-time-tab.js index 8dbdbfc24..78780794b 100644 --- a/html/components/team-time-tab.js +++ b/html/components/team-time-tab.js @@ -724,7 +724,7 @@ function createTeamTable(gameId) { colorA.toggleClass('AlternateName', v != null); }); - var names = nameA.add(altNameA); + var names = nameA.add(colorA).add(altNameA); WS.Register(prefix + '.Color(*)', function (k, v) { v = v || ''; switch (k.Color) {