# HG changeset patch # User Paul Boddie # Date 1412595512 -7200 # Node ID f05956c21b4eaf68f7a71b4ba73d6c0d96f90343 # Parent 4c9ac6dc91678450fcf3891c4c58c84964e35941 Removed counter tests where the ordering could affect the outcome. diff -r 4c9ac6dc9167 -r f05956c21b4e vRecurrence.py --- a/vRecurrence.py Mon Oct 06 00:30:52 2014 +0200 +++ b/vRecurrence.py Mon Oct 06 13:38:32 2014 +0200 @@ -314,7 +314,7 @@ counter = count and [0, count] results = self.materialise_items(self.context, start, end, counter) results.sort() - return results + return results[:count] def materialise_item(self, current, last, next, counter): if counter is None or counter[0] < counter[1]: @@ -393,7 +393,7 @@ else: current = to_tuple(get_first_day(first_day, value) + offset, 3) - if current < end and (counter is None or counter[0] < counter[1]): + if current < end: next = update(current, step) results += self.materialise_item(current, max(current, start), min(next, end), counter) @@ -406,7 +406,7 @@ direction = operator.add while first_day <= current <= last_day: - if current < end and (counter is None or counter[0] < counter[1]): + if current < end: next = update(current, step) results += self.materialise_item(current, max(current, start), min(next, end), counter) current = to_tuple(direction(date(*current), timedelta(7)), 3) @@ -419,7 +419,7 @@ results = [] for value in self.args["values"]: current = combine(context, scale(value, self.pos)) - if current < end and (counter is None or counter[0] < counter[1]): + if current < end: next = update(current, step) results += self.materialise_item(current, max(current, start), min(next, end), counter) return results @@ -433,7 +433,7 @@ if value < 0: value = last_day + 1 + value current = combine(context, scale(value, self.pos)) - if current < end and (counter is None or counter[0] < counter[1]): + if current < end: next = update(current, step) results += self.materialise_item(current, max(current, start), min(next, end), counter) return results @@ -449,7 +449,7 @@ if value < 0: value = year_length + 1 + value current = to_tuple(first_day + timedelta(value - 1), 3) - if current < end and (counter is None or counter[0] < counter[1]): + if current < end: next = update(current, step) results += self.materialise_item(current, max(current, start), min(next, end), counter) return results