From 867812fba7d1588c730b6df4da6864064296248d Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 17 Jan 2022 01:07:32 +0100 Subject: [PATCH] canonicalize ids here and there --- larigira/db.py | 4 +++- larigira/dbadmin/__init__.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/larigira/db.py b/larigira/db.py index ea3cff7..bfd4249 100644 --- a/larigira/db.py +++ b/larigira/db.py @@ -115,7 +115,9 @@ class EventModel(object): def get_all_alarms(self) -> list: out = [] for db in self._dbs: - out.extend(self._dbs[db].table('alarms').all()) + for alarm in self._dbs[db].table('alarms').all(): + alarm.doc_id = '%s:%s' % (db, alarm.doc_id) + out.append(alarm) return out def get_all_actions(self) -> list: diff --git a/larigira/dbadmin/__init__.py b/larigira/dbadmin/__init__.py index 494337e..fbf2e52 100644 --- a/larigira/dbadmin/__init__.py +++ b/larigira/dbadmin/__init__.py @@ -124,7 +124,7 @@ def edit_time(alarmid): model.update_alarm(alarmid, data) model.reload() return redirect( - url_for("db.events_calendar", highlight="%d" % alarmid) + url_for("db.events_calendar", highlight=model.canonicalize(alarmid)) ) return render_template( "add_time_kind.html",