mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 17:33:55 +00:00
cursor fixes
- delete would use wrong index to relocate - cursor uses eventId instead of eventIndex - cursor would move on any item changes
This commit is contained in:
@@ -476,7 +476,7 @@ export class EventTimer extends Timer {
|
||||
|
||||
// update selected event index
|
||||
this.selectedEventIndex = this._eventlist.findIndex(
|
||||
(e) => e.id === eventId
|
||||
(e) => e.id === this.selectedEventId
|
||||
);
|
||||
|
||||
// reload titles if necessary
|
||||
|
||||
@@ -152,7 +152,7 @@ export const eventsPut = async (req, res) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const eventIndex = data.events.findIndex((e) => e.id === req.body.id);
|
||||
const eventIndex = data.events.findIndex((e) => e.id === eventId);
|
||||
if (eventIndex === -1) {
|
||||
res.status(400).send(`No Id found found`);
|
||||
return;
|
||||
@@ -164,7 +164,7 @@ export const eventsPut = async (req, res) => {
|
||||
db.write();
|
||||
|
||||
// update timer
|
||||
_updateTimersSingle(req.body.id, req.body);
|
||||
_updateTimersSingle(eventId, req.body);
|
||||
|
||||
res.sendStatus(200);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user