Comparison

plugins/mod_storage_internal.lua @ 10843:8fcd46ee9bf5 0.11

mod_storage_internal: Fix error in time limited queries on items without 'when' field, fixes #1557
author Kim Alvefur <zash@zash.se>
date Fri, 15 May 2020 21:22:35 +0200
parent 9105:e735c9865f42
child 10844:05f4386c846e
comparison
equal deleted inserted replaced
10834:c6e852984d48 10843:8fcd46ee9bf5
102 return item.with == query.with; 102 return item.with == query.with;
103 end); 103 end);
104 end 104 end
105 if query.start then 105 if query.start then
106 items:filter(function (item) 106 items:filter(function (item)
107 return item.when >= query.start; 107 local when = item.when or datetime.parse(item.attr.stamp);
108 return when >= query.start;
108 end); 109 end);
109 end 110 end
110 if query["end"] then 111 if query["end"] then
111 items:filter(function (item) 112 items:filter(function (item)
112 return item.when <= query["end"]; 113 local when = item.when or datetime.parse(item.attr.stamp);
114 return when <= query["end"];
113 end); 115 end);
114 end 116 end
115 count = #items; 117 count = #items;
116 if query.reverse then 118 if query.reverse then
117 items:reverse(); 119 items:reverse();