diff mod_http_muc_log/mod_http_muc_log.lua @ 2841:462dece0a3c2

mod_http_muc_log: Parse date out of path once
author Kim Alvefur <zash@zash.se>
date Tue, 21 Nov 2017 00:02:58 +0100
parents 683a2f25223d
children 263c0b044973
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Mon Nov 20 20:47:38 2017 +0100
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Tue Nov 21 00:02:58 2017 +0100
@@ -191,11 +191,12 @@
 		return years_page(event, path);
 	end
 	if not public_room(room) then return end
+	local day_start = datetime.parse(date.."T00:00:00Z");
 
 	local logs, i = {}, 1;
 	local iter, err = archive:find(room, {
-		["start"] = datetime.parse(date.."T00:00:00Z");
-		["end"]   = datetime.parse(date.."T23:59:59Z");
+		["start"] = day_start;
+		["end"]   = day_start + 86399;
 	});
 	if not iter then
 		module:log("warn", "Could not search archive: %s", err or "no error");