Ensure there is always items

This commit is contained in:
nemunaire 2022-12-15 16:29:48 +01:00
parent 41a8d1e3e2
commit dcb1779e0a
2 changed files with 10 additions and 2 deletions

View File

@ -9,11 +9,15 @@ export class AlarmRepeated {
this.id = id;
this.weekday = weekday;
this.time = time;
this.routines = routines;
this.routines = routines == null ? [] : routines;
this.ignore_exceptions = ignore_exceptions;
this.comment = comment;
this.excepts = excepts;
this.next_time = next_time;
if (this.routines.length < 1) {
this.routines.push("");
}
}
async delete() {

View File

@ -8,8 +8,12 @@ export class AlarmSingle {
update({ id, time, routines, comment }) {
this.id = id;
this.time = new Date(time);
this.routines = routines;
this.routines = routines == null ? [] : routines;
this.comment = comment;
if (this.routines.length < 1) {
this.routines.push("");
}
}
async delete() {