Diff

mod_lastlog2/mod_lastlog2.lua @ 5799:5239ed05bd71

mod_lastlog2: Fix to interpret stored data structure correctly
author Matthew Wild <mwild1@gmail.com>
date Wed, 06 Dec 2023 15:07:09 +0000
parent 5797:7b722955c59b
child 5900:c5df6d53f17f
line wrap: on
line diff
--- a/mod_lastlog2/mod_lastlog2.lua	Wed Dec 06 12:14:12 2023 +0000
+++ b/mod_lastlog2/mod_lastlog2.lua	Wed Dec 06 15:07:09 2023 +0000
@@ -56,7 +56,9 @@
 		else
 			local last_activity = kv_store:get(username);
 			if not last_activity then return nil; end
-			local latest = math.max(last_activity.login or 0, last_activity.logout or 0);
+			local last_login = last_activity.login;
+			local last_logout = last_activity.logout;
+			local latest = math.max(last_login and last_login.timestamp or 0, last_logout and last_logout.timestamp or 0);
 			if latest == 0 then
 				return nil; -- Never logged in
 			end