plugins/mod_storage_internal.lua
changeset 10226 51f145094648
parent 10225 068692cb9e78
child 10227 d185c4961ee0
--- a/plugins/mod_storage_internal.lua	Fri Aug 23 01:10:27 2019 +0200
+++ b/plugins/mod_storage_internal.lua	Fri Aug 23 01:15:44 2019 +0200
@@ -218,13 +218,18 @@
 	local iter, err = self:find(username, query)
 	if not iter then return iter, err; end
 	local counts = {};
+	local earliest = {};
 	local latest = {};
 	for _, _, when, with in iter do
 		counts[with] = (counts[with] or 0) + 1;
+		if earliest[with] == nil then
+			earliest[with] = when;
+		end
 		latest[with] = when;
 	end
 	return {
 		counts = counts;
+		earliest = earliest;
 		latest = latest;
 	};
 end