Commit ce855508 authored by Martin Mareš's avatar Martin Mareš
Browse files

Hook: Debugging

parent c47a2d1c
......@@ -3,9 +3,6 @@
- Reloading
- Ztlumit logování
- Trigger na "last modified" u meetingů
- zjistit, jak funguje type=3, například 673556078 (negenerují se
další instance, které mají stejné id, ale jiné uuid?)
- hooky na create/delete user
- přehlednější log
- type=1 ignorovat (nestěžovat si, že je unknown)
- indexy
......@@ -64,14 +64,14 @@ class HookApp:
def create_schedule(self, mid, meeting_id, occurrence_id, occ):
self.log("Meeting {meeting_id}.{occurrence_id}: Scheduling")
self.log(f"Meeting {meeting_id}.{occurrence_id}: Scheduling")
INSERT INTO zoom_schedule
(mid, occurrence_id, start_time, duration)
VALUES (%s, %s, %s, %s)
""", (
......@@ -155,8 +155,8 @@ class HookApp:
if "duration" in new:
self.log(f"Meeting {meeting_id}.{occurrence_id}: Updating duration")
db_query("UPDATE zoom_meetings SET duration=%s WHERE meeting_id=%s AND (occurrence_id=%s OR %s = '0')",
(new['duration'], meeting_id, occurrence_id, occurrence_id))
db_query("UPDATE zoom_schedule SET duration=%s WHERE mid=%s AND occurrence_id=%s",
(new['duration'], mid, occurrence_id))
def update_meeting_single(self, mid, meeting_id, old, new):
......@@ -167,13 +167,12 @@ class HookApp:
def update_meeting_all(self, mid, meeting_id, old, new):
self.log(f"Meeting {meeting_id}: Updating all occurrences")
if "occurrences" in new:
# So this will be a recurrent meeting, replace all occurrences
self.log(f"Meeting {meeting_id}: Replacing all occurrences")
db_query("DELETE FROM zoom_schedule WHERE mid=%s", (mid,))
for occ in meeting["occurrences"]:
self.create_schedule(mid, meeting_id, occ["occurrence_id"], new)
for occ in new["occurrences"]:
self.create_schedule(mid, meeting_id, occ["occurrence_id"], occ)
elif "start_time" in new:
if new["start_time"] == "":
......@@ -191,6 +190,11 @@ class HookApp:
db_query("UPDATE zoom_schedule SET start_time=%s WHERE mid=%s",
(parse_time(new["start_time"]), mid))
elif "occurrences" in old:
# Descheduling (this can happen when changing type 8 to type 3)
self.log(f"Meeting {meeting_id}: Descheduling")
db_query("DELETE FROM zoom_schedule WHERE mid=%s", (mid,))
elif "duration" in new:
# This is just a schedule change
self.log(f"Meeting {meeting_id}.0: Rescheduling with new duration")
......@@ -211,7 +215,7 @@ class HookApp:
mid = meeting_row.mid
old_type = meeting_row.type
old_type = old.get("type", -1)
new_type = new.get("type", -1)
if old_type != new_type:
self.log(f"Meeting {meeting_id}: Transmuting from from type {old_type} to {new_type}")
......@@ -228,7 +232,7 @@ class HookApp:
scope = payload.get("scope", "all")
if scope == "single":
self.update_meeting_single(mid, meeting_id, old, new)
elif scope == all":
elif scope == "all":
self.update_meeting_all(mid, meeting_id, old, new)
self.log(f"Meeting {meeting_id}: Unsupported update scope {scope}")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment