fix (schedule): Fix record indexing.
This commit is contained in:
@@ -656,7 +656,7 @@ class ScheduleUI(MessageUI):
|
|||||||
|
|
||||||
# Calculate all-time stats
|
# Calculate all-time stats
|
||||||
if recent_count == 100:
|
if recent_count == 100:
|
||||||
record = await booking_model.table.select_one_where(
|
records = await booking_model.table.select_one_where(
|
||||||
booking_model.slotid < nowid,
|
booking_model.slotid < nowid,
|
||||||
userid=self.userid,
|
userid=self.userid,
|
||||||
).select(
|
).select(
|
||||||
@@ -664,6 +664,7 @@ class ScheduleUI(MessageUI):
|
|||||||
_attended='COUNT(*) FILTER (WHERE attended)',
|
_attended='COUNT(*) FILTER (WHERE attended)',
|
||||||
_clocked='SUM(COALESCE(clock, 0))'
|
_clocked='SUM(COALESCE(clock, 0))'
|
||||||
).with_no_adapter()
|
).with_no_adapter()
|
||||||
|
record = records[0]
|
||||||
self.all_stats = (record['_attended'], record['_booked'])
|
self.all_stats = (record['_attended'], record['_booked'])
|
||||||
self.all_avg = record['_clocked'] // (60 * record['_booked'])
|
self.all_avg = record['_clocked'] // (60 * record['_booked'])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user