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/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') 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', ''); }) ) ) diff --git a/html/components/team-time-tab.js b/html/components/team-time-tab.js index 9772bb2a7..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) { @@ -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']) 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 } } } diff --git a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java index 68540d469..998b8279a 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); @@ -245,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; diff --git a/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java b/src/com/carolinarollergirls/scoreboard/utils/StatsbookExporter.java index 3ebccaf40..7b2437961 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)); @@ -175,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) { @@ -251,6 +251,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 +317,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 +691,7 @@ private void createCellStyles(Sheet igrf) { private String[][] sk = {{"", ""}, {"", ""}}; private String[][] jr = {{"", ""}, {"", ""}}; private String[][] lt = {{"", ""}, {"", ""}}; + private String[][] pbt = {{"", ""}, {"", ""}}; private List injuries;