Changeset

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
parents 5798:4c3216d9b118
children 5800:34b46d157797
files mod_lastlog2/mod_lastlog2.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
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