summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvuko <vuko@hackerspace.pl>2020-10-24 02:43:54 +0200
committervuko <vuko@hackerspace.pl>2020-10-24 02:43:54 +0200
commitd25e0812b7ec20d3db0ab2608b9244e4e0e87384 (patch)
tree24a6296a21552656c695c27acc2dbde90999d3d9
parent38c214ed2580c577f7fcd24242e6436157794c2f (diff)
downloadcheckinator-d25e0812b7ec20d3db0ab2608b9244e4e0e87384.tar.gz
checkinator-d25e0812b7ec20d3db0ab2608b9244e4e0e87384.tar.bz2
checkinator-d25e0812b7ec20d3db0ab2608b9244e4e0e87384.zip
fix users listing
-rw-r--r--at/web.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/at/web.py b/at/web.py
index e758390..a1a7fc2 100644
--- a/at/web.py
+++ b/at/web.py
@@ -123,7 +123,7 @@ def app(instance_path, devices_api, config):
devices = app.updater.get_active_devices()
macs = list(devices.keys())
- identified_devices = get_device_infos(g.db, macs)
+ identified_devices = list(get_device_infos(g.db, macs))
unknown = set(macs) - set(d.hwaddr for d in identified_devices)
# das kektop sorting maschine
@@ -141,11 +141,12 @@ def app(instance_path, devices_api, config):
users = {}
for info in identified_devices:
# append device to user
- owner_devices = users.get(info.owner, [])
- owner_devices.append(devices[info.hwaddr][0])
- users.set(info.owner, owner_devices)
+ last_seen = users.get(info.owner, 0)
+ if not info.ignored:
+ last_seen = max(last_seen, devices[info.hwaddr].atime)
+ users[info.owner] = last_seen
- result['users'] = sorted(users.items(), key=lambda u_a: u_a[1].last_seen, reverse=True)
+ result['users'] = sorted(users.items(), key=lambda u_l: (u_l[1], u_l[0]), reverse=True)
return result