Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tweets conditioned on specific countdown clock value #467

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,25 +357,38 @@ protected void setupClockValues(String c, final String id) {
@Override
public String getValue() { return getClockSecs(id); }
@Override
public String getPreviousValue(Object o) { return getClockSecs(((Long) o).longValue()); }
public String getPreviousValue(Object o) {
return getClockSecs(((Long) o), getClock(id).isCountDirectionDown());
}
};
new ScoreBoardValue("%c" + c + "tms", "Clock " + id + " Time (min:sec)", getClock(id), Clock.TIME) {
@Override
public String getValue() { return getClockMinSecs(id); }
@Override
public String getPreviousValue(Object o) { return getClockMinSecs(((Long) o).longValue()); }
public String getPreviousValue(Object o) {
return getClockMinSecs(((Long) o), getClock(id).isCountDirectionDown());
}
};
}

protected Clock getClock(String id) { return getScoreBoard().getClock(id); }

protected String getClockSecs(String id) { return getClockSecs(getClock(id).getTime()); }
protected String getClockSecs(long time) { return String.valueOf(time / 1000); }
protected String getClockMinSecs(String id) { return getClockMinSecs(getClock(id).getTime()); }
protected String getClockMinSecs(long time) {
time = (time / 1000);
String min = String.valueOf(time / 60);
String sec = String.valueOf(time % 60);
protected String getClockSecs(String id) {
return getClockSecs(getClock(id).getTime(), getClock(id).isCountDirectionDown());
}
protected String getClockSecs(long time, boolean roundUp) {
long roundedTime = time / 1000;
if (roundUp && time % 1000 != 0) { roundedTime++; }
return String.valueOf(roundedTime);
}
protected String getClockMinSecs(String id) {
return getClockMinSecs(getClock(id).getTime(), getClock(id).isCountDirectionDown());
}
protected String getClockMinSecs(long time, boolean roundUp) {
long roundedTime = time / 1000;
if (roundUp && time % 1000 != 0) { roundedTime++; }
String min = String.valueOf(roundedTime / 60);
String sec = String.valueOf(roundedTime % 60);
if (sec.length() == 1) {
sec = "0" + sec;
}
Expand Down