chore: rename time-to-end to count-to-end

This commit is contained in:
Carlos Valente
2024-12-18 19:43:12 +01:00
committed by Carlos Valente
parent c9ef2465f8
commit 2f2c26ed00
30 changed files with 115 additions and 122 deletions
+6 -6
View File
@@ -19,7 +19,7 @@ export function getExpectedFinish(state: RuntimeState): MaybeNumber {
return null;
}
const { isTimeToEnd, timeEnd } = state.eventNow;
const { countToEnd, timeEnd } = state.eventNow;
const { pausedAt } = state._timer;
const { clock } = state;
@@ -33,7 +33,7 @@ export function getExpectedFinish(state: RuntimeState): MaybeNumber {
const pausedTime = pausedAt != null ? clock - pausedAt : 0;
if (isTimeToEnd) {
if (countToEnd) {
return timeEnd + addedTime + pausedTime;
}
@@ -62,11 +62,11 @@ export function getCurrent(state: RuntimeState): number {
}
}
const { startedAt, duration, addedTime } = state.timer;
const { isTimeToEnd, timeStart, timeEnd } = state.eventNow;
const { countToEnd, timeStart, timeEnd } = state.eventNow;
const { pausedAt } = state._timer;
const { clock } = state;
if (isTimeToEnd) {
if (countToEnd) {
const isEventOverMidnight = timeStart > timeEnd;
const correctDay = isEventOverMidnight ? dayInMs : 0;
return correctDay - clock + timeEnd + addedTime;
@@ -131,7 +131,7 @@ export function getRuntimeOffset(state: RuntimeState): number {
}
const { clock } = state;
const { isTimeToEnd, timeStart } = state.eventNow;
const { countToEnd, timeStart } = state.eventNow;
const { addedTime, current, startedAt } = state.timer;
// if we havent started, but the timer is armed
@@ -142,7 +142,7 @@ export function getRuntimeOffset(state: RuntimeState): number {
const overtime = Math.min(current, 0);
// in time-to-end, offset is overtime
if (isTimeToEnd) {
if (countToEnd) {
return overtime;
}