def report(self, request, tag): shift_elements = [] max = int(num_shifts_from_query(request)) count = 0 for shift in sorted(self.incidents_by_shift, reverse=True): if max: count += 1 if count > max: break element = ShiftActivityElement( self.ims, shift, self.incidents_by_shift[shift] ) shift_elements.append(element) return tag(shift_elements)
def num_shifts_selected(self, request, tag): if tag.attributes["value"] == num_shifts_from_query(request): return tag(selected="") else: return tag