diff --git a/html/components/settings-tab/index.html b/html/components/settings-tab/index.html index f80cf6ea..11146f26 100644 --- a/html/components/settings-tab/index.html +++ b/html/components/settings-tab/index.html @@ -3,13 +3,6 @@
General Settings
- - - -
diff --git a/html/javascript/utils.js b/html/javascript/utils.js index e1ab1bef..e1a1e68c 100644 --- a/html/javascript/utils.js +++ b/html/javascript/utils.js @@ -25,10 +25,10 @@ function sbClockSelect(k) { var clock = 'NoClock'; if (jam) { clock = 'Jam'; - } else if (timeout) { - clock = 'Timeout'; } else if (lineup) { clock = 'Lineup'; + } else if (timeout) { + clock = 'Timeout'; } else if (intermission) { clock = 'Intermission'; } diff --git a/src/com/carolinarollergirls/scoreboard/core/admin/SettingsImpl.java b/src/com/carolinarollergirls/scoreboard/core/admin/SettingsImpl.java index 729d50bd..7b482dbc 100644 --- a/src/com/carolinarollergirls/scoreboard/core/admin/SettingsImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/admin/SettingsImpl.java @@ -57,7 +57,6 @@ private void setDefaults() { set(ScoreBoard.SETTING_AUTO_START_BUFFER, "0:02"); set(ScoreBoard.SETTING_AUTO_END_JAM, "false"); set(ScoreBoard.SETTING_AUTO_END_TTO, "false"); - set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, Clock.ID_LINEUP); set(Clock.SETTING_SYNC, "true"); set(Team.SETTING_DISPLAY_NAME, Team.OPTION_LEAGUE_NAME); set(Game.SETTING_DEFAULT_NAME_FORMAT, "%d %G %1 vs. %2 (%s: %S)"); diff --git a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java index 28f2eb82..0e598107 100644 --- a/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java @@ -758,9 +758,7 @@ private void _possiblyEndPeriod() { private void _startJam() { Clock pc = getClock(Clock.ID_PERIOD); Clock jc = getClock(Clock.ID_JAM); - Clock tc = getClock(Clock.ID_TIMEOUT); - if (!getCurrentTimeout().isRunning()) { tc.stop(); } _endIntermission(false); _endLineup(); if (!getBoolean(Rule.TO_JAM) || !getCurrentTimeout().isRunning()) { pc.start(); } @@ -837,7 +835,7 @@ private void _endTimeout(boolean timeoutFollows) { if (!getCurrentTimeout().isRunning()) { return; } getCurrentTimeout().stop(); - if (!getSetting(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT).equals(Clock.ID_TIMEOUT)) { tc.stop(); } + tc.stop(); if (!timeoutFollows) { set(CURRENT_TIMEOUT, noTimeoutDummy); if (pc.isTimeAtEnd()) { diff --git a/src/com/carolinarollergirls/scoreboard/core/game/TimeoutImpl.java b/src/com/carolinarollergirls/scoreboard/core/game/TimeoutImpl.java index 3a81f304..221af109 100644 --- a/src/com/carolinarollergirls/scoreboard/core/game/TimeoutImpl.java +++ b/src/com/carolinarollergirls/scoreboard/core/game/TimeoutImpl.java @@ -109,10 +109,13 @@ public void execute(Command prop, Source source) { public void stop() { set(RUNNING, false); if (getOwner() == Owners.NONE) { set(OWNER, Owners.OTO); } - set(DURATION, game.getClock(Clock.ID_TIMEOUT).getTimeElapsed()); set(WALLTIME_END, ScoreBoardClock.getInstance().getCurrentWalltime()); - set(PERIOD_CLOCK_ELAPSED_END, game.getClock(Clock.ID_PERIOD).getTimeElapsed()); - set(PERIOD_CLOCK_END, game.getClock(Clock.ID_PERIOD).getTime()); + if (!game.getClock(Clock.ID_PERIOD).isRunning()) { + // don't record duration when ended late + set(DURATION, game.getClock(Clock.ID_TIMEOUT).getTimeElapsed()); + set(PERIOD_CLOCK_ELAPSED_END, game.getClock(Clock.ID_PERIOD).getTimeElapsed()); + set(PERIOD_CLOCK_END, game.getClock(Clock.ID_PERIOD).getTime()); + } } @Override diff --git a/src/com/carolinarollergirls/scoreboard/core/interfaces/ScoreBoard.java b/src/com/carolinarollergirls/scoreboard/core/interfaces/ScoreBoard.java index 58dd80dd..a8bda7e0 100644 --- a/src/com/carolinarollergirls/scoreboard/core/interfaces/ScoreBoard.java +++ b/src/com/carolinarollergirls/scoreboard/core/interfaces/ScoreBoard.java @@ -53,7 +53,6 @@ public interface ScoreBoard extends ScoreBoardEventProvider { new Child<>(PreparedOfficial.class, "PreparedOfficial", props); public static final Child CURRENT_GAME = new Child<>(CurrentGame.class, "CurrentGame", props); - public static final String SETTING_CLOCK_AFTER_TIMEOUT = "ScoreBoard.ClockAfterTimeout"; public static final String SETTING_AUTO_START = "ScoreBoard.AutoStart"; public static final String SETTING_AUTO_START_BUFFER = "ScoreBoard.AutoStartBuffer"; public static final String SETTING_AUTO_END_JAM = "ScoreBoard.AutoEndJam"; diff --git a/src/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONSetter.java b/src/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONSetter.java index b714fcc6..91d07719 100644 --- a/src/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONSetter.java +++ b/src/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONSetter.java @@ -108,6 +108,7 @@ public static void updateToCurrentVersion(Map state) { if (newKey.startsWith("ScoreBoard.Clients.Client") || (newKey.startsWith("ScoreBoard.Settings.Setting(ScoreBoard.Operator") && newKey.endsWith("StartStopButtons)")) || + newKey.equals("ScoreBoard.Settings.Setting(ScoreBoard.ClockAfterTimeout)") || newKey.endsWith("FirstJam") || newKey.endsWith("FirstJamNumber")) { newKey = ""; } @@ -229,8 +230,9 @@ private static String maxVersionWith(String key, String priorLimit) { if (priorLimit.equals("v5") || key.startsWith("ScoreBoard.Twitter")) { return "v5"; } if (priorLimit.equals("v2023") || key.equals("ScoreBoard.Settings.Setting(Overlay.Interactive.ShowAllNames)") || (key.startsWith("ScoreBoard.Settings.Setting(ScoreBoard.Operator") && key.endsWith("StartStopButtons")) || - key.contains("Jam.SuddenScoringMaxTrainingPoints") || key.startsWith("ScoreBoard.Clients.Client(") || - key.endsWith("FirstJam") || key.endsWith("FirstJamNumber")) { + key.contains("Jam.SuddenScoringMaxTrainingPoints") || key.contains("ScoreBoard.ClockAfterTimeout") || + key.startsWith("ScoreBoard.Clients.Client(") || key.endsWith("FirstJam") || + key.endsWith("FirstJamNumber")) { return "v2023"; } diff --git a/tests/com/carolinarollergirls/scoreboard/core/game/GameImplTests.java b/tests/com/carolinarollergirls/scoreboard/core/game/GameImplTests.java index cc03f21e..33d6d6c4 100644 --- a/tests/com/carolinarollergirls/scoreboard/core/game/GameImplTests.java +++ b/tests/com/carolinarollergirls/scoreboard/core/game/GameImplTests.java @@ -98,7 +98,6 @@ public void setUp() throws Exception { sb.addScoreBoardListener(batchCounter); // Clock Sync can cause clocks to be changed when started, breaking tests. sb.getSettings().set(Clock.SETTING_SYNC, "False"); - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, "Lineup"); checkPeriodJamInvariants(); } @@ -786,37 +785,6 @@ public void testStopJam_endTimeoutAfterPeriod() { Game.UNDO_PREFIX + Game.ACTION_STOP_TO); } - @Test - public void testStopJam_endTimeoutKeepTimeoutClock() { - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, "Timeout"); - - g.startJam(); - g.timeout(); - assertFalse(pc.isRunning()); - assertFalse(pc.isTimeAtEnd()); - assertFalse(jc.isRunning()); - assertFalse(lc.isRunning()); - tc.setTime(32000); - tc.setNumber(8); - assertFalse(ic.isRunning()); - assertEquals(Timeout.Owners.NONE, g.getTimeoutOwner()); - assertFalse(g.isOfficialReview()); - - g.stopJamTO(); - - assertFalse(pc.isRunning()); - assertFalse(jc.isRunning()); - assertTrue(lc.isRunning()); - assertTrue(tc.isRunning()); - assertEquals(32000, tc.getTimeElapsed()); - assertEquals(8, tc.getNumber()); - assertFalse(ic.isRunning()); - assertEquals(Timeout.Owners.NONE, g.getTimeoutOwner()); - assertFalse(g.isOfficialReview()); - checkLabels(Game.ACTION_START_JAM, Game.ACTION_NONE, Game.ACTION_TIMEOUT, - Game.UNDO_PREFIX + Game.ACTION_STOP_TO); - } - @Test public void testStopJam_lineupEarlyInIntermission() { fastForwardPeriod(); @@ -1567,29 +1535,6 @@ public void testTimeoutInLast30s() { assertEquals(22000, pc.getTimeRemaining()); } - @Test - public void testPeriodEndWithTimeoutClock() { - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, Clock.ID_TIMEOUT); - - assertTrue(pc.isCountDirectionDown()); - g.startJam(); - pc.setTime(25000); - g.stopJamTO(); - assertTrue(g.get(Game.NO_MORE_JAM)); - g.timeout(); - advance(35000); - assertTrue(g.get(Game.NO_MORE_JAM)); - g.setTimeoutType(Timeout.Owners.OTO, false); - assertTrue(g.get(Game.NO_MORE_JAM)); - g.stopJamTO(); - assertTrue(g.get(Game.NO_MORE_JAM)); - assertTrue(pc.isRunning()); - advance(26000); - assertTrue(ic.isRunning()); - assertFalse(tc.isRunning()); - assertFalse(pc.isRunning()); - } - @Test public void testP2StartLineupAfter() { // jam ended after 30s mark, no more jams. diff --git a/tests/com/carolinarollergirls/scoreboard/core/game/TeamImplTests.java b/tests/com/carolinarollergirls/scoreboard/core/game/TeamImplTests.java index a16acc6c..9513b276 100644 --- a/tests/com/carolinarollergirls/scoreboard/core/game/TeamImplTests.java +++ b/tests/com/carolinarollergirls/scoreboard/core/game/TeamImplTests.java @@ -12,7 +12,6 @@ import org.junit.Test; import com.carolinarollergirls.scoreboard.core.ScoreBoardImpl; -import com.carolinarollergirls.scoreboard.core.interfaces.Clock; import com.carolinarollergirls.scoreboard.core.interfaces.CurrentGame; import com.carolinarollergirls.scoreboard.core.interfaces.Fielding; import com.carolinarollergirls.scoreboard.core.interfaces.FloorPosition; @@ -123,7 +122,6 @@ public void testOfficialReview() { @Test public void testSetRetainedOfficialReview() { - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, Clock.ID_LINEUP); assertFalse(team.retainedOfficialReview()); assertEquals(1, team.getOfficialReviews()); sb.addScoreBoardListener(new ConditionalScoreBoardListener<>(team, Team.RETAINED_OFFICIAL_REVIEW, listener)); @@ -162,7 +160,6 @@ public void testSetRetainedOfficialReview() { @Test public void testTimeoutsResetAtHalf() { - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, Clock.ID_LINEUP); team.timeout(); advance(60000); g.timeout(); diff --git a/tests/com/carolinarollergirls/scoreboard/core/prepared/RulesetsImplTests.java b/tests/com/carolinarollergirls/scoreboard/core/prepared/RulesetsImplTests.java index 07bdaee8..9e47dc51 100644 --- a/tests/com/carolinarollergirls/scoreboard/core/prepared/RulesetsImplTests.java +++ b/tests/com/carolinarollergirls/scoreboard/core/prepared/RulesetsImplTests.java @@ -27,7 +27,6 @@ public class RulesetsImplTests { public void setUp() throws Exception { sb = new ScoreBoardImpl(false); sb.postAutosaveUpdate(); - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, "Lineup"); rulesets = sb.getRulesets(); root = rulesets.getRuleset(RulesetsImpl.ROOT_ID); } diff --git a/tests/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONListenerTests.java b/tests/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONListenerTests.java index 88fcd637..6c8f9e1c 100644 --- a/tests/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONListenerTests.java +++ b/tests/com/carolinarollergirls/scoreboard/json/ScoreBoardJSONListenerTests.java @@ -21,7 +21,6 @@ import com.carolinarollergirls.scoreboard.core.interfaces.Role; import com.carolinarollergirls.scoreboard.core.interfaces.Rulesets; import com.carolinarollergirls.scoreboard.core.interfaces.Rulesets.Ruleset; -import com.carolinarollergirls.scoreboard.core.interfaces.ScoreBoard; import com.carolinarollergirls.scoreboard.core.interfaces.Skater; import com.carolinarollergirls.scoreboard.core.interfaces.Team; import com.carolinarollergirls.scoreboard.core.prepared.RulesetsImpl; @@ -66,7 +65,6 @@ public void setUp() throws Exception { sb.postAutosaveUpdate(); g = sb.getCurrentGame().get(CurrentGame.GAME); gameId = g.getId(); - sb.getSettings().set(ScoreBoard.SETTING_CLOCK_AFTER_TIMEOUT, Clock.ID_LINEUP); sb.getSettings().set(Clock.SETTING_SYNC, String.valueOf(false)); jsm = new JSONStateManager(false);