refactor: allow aux change direction while playing

This commit is contained in:
Carlos Valente
2024-10-04 14:00:06 +02:00
committed by Carlos Valente
parent 9a6ca7ac67
commit 16fd44a441
6 changed files with 92 additions and 21 deletions
@@ -230,8 +230,9 @@ const actionHandlers: Record<string, ActionHandler> = {
} else if (command && typeof command === 'object') {
const reply = { payload: {} };
if ('duration' in command) {
const time = numberOrError(command.duration);
reply.payload = auxTimerService.setTime(time * 1000); //frontend is seconds based
// convert duration in seconds to ms
const timeInMs = numberOrError(command.duration) * 1000;
reply.payload = auxTimerService.setTime(timeInMs);
}
if ('direction' in command) {
if (command.direction === SimpleDirection.CountUp || command.direction === SimpleDirection.CountDown) {