From eb2abb7026b7382a67a7a82ae1be939183f76013 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Mon, 22 Nov 2021 22:48:55 +0100 Subject: [PATCH] fix: bug in osc goto (#44) --- server/src/classes/EventTimer.js | 4 ++-- server/src/controllers/OscController.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/classes/EventTimer.js b/server/src/classes/EventTimer.js index b87c81023..2224b2d72 100644 --- a/server/src/classes/EventTimer.js +++ b/server/src/classes/EventTimer.js @@ -654,7 +654,7 @@ export class EventTimer extends Timer { } loadEventById(eventId) { - let eventIndex = this._eventlist.findIndex((e) => e.id === eventId); + const eventIndex = this._eventlist.findIndex((e) => e.id === eventId); if (eventIndex === -1) return; this.pause(); @@ -662,7 +662,7 @@ export class EventTimer extends Timer { } loadEventByIndex(eventIndex) { - if (eventIndex === -1 || index > this.numEvents) return; + if (eventIndex === -1 || eventIndex > this.numEvents) return; this.pause(); this.loadEvent(eventIndex, 'load', true); } diff --git a/server/src/controllers/OscController.js b/server/src/controllers/OscController.js index e9508ac4a..a9a59e1b4 100644 --- a/server/src/controllers/OscController.js +++ b/server/src/controllers/OscController.js @@ -71,7 +71,7 @@ export const initiateOSC = (config) => { case 'delay': console.log('calling delay with', args); try { - let t = parseInt(args); + const t = parseInt(args); if (isNaN(t)) { console.error(`OSC IN: delay time not recognised ${args}`); return; @@ -84,13 +84,13 @@ export const initiateOSC = (config) => { case 'goto': console.log('calling goto with', args); try { - let eventIndex = parseInt(args); + const eventIndex = parseInt(args); if (isNaN(eventIndex) || eventIndex <= 0 || eventIndex == null) { console.error( `OSC IN: event index not recognised or out of range ${eventIndex}` ); } - global.timer.loadEventByIndex(eventIndex - 1, undefined, true); + global.timer.loadEventByIndex(eventIndex - 1); } catch (error) { console.log('error calling goto: ', error); }