def get_all_filtered(self, filters): tag, start, end, simple = radicale_filter.simplify_prefilters( filters, collection_tag=self.get_meta("tag")) if not tag: # no filter yield from ((item, simple) for item in self.get_all()) return for item in (self.get(h, verify_href=False) for h in self.list()): istart, iend = item.time_range if tag == item.component_name and istart < end and iend > start: yield item, simple and (start <= istart or iend <= end)
def get_filtered(self, filters): """Fetch all items with optional filtering. This can largely improve performance of reports depending on the filters and this implementation. Returns tuples in the form ``(item, filters_matched)``. ``filters_matched`` is a bool that indicates if ``filters`` are fully matched. """ tag, start, end, simple = radicale_filter.simplify_prefilters( filters, collection_tag=self.get_meta("tag")) for item in self.get_all(): if tag: if tag != item.component_name: continue istart, iend = item.time_range if istart >= end or iend <= start: continue item_simple = simple and (start <= istart or iend <= end) else: item_simple = simple yield item, item_simple