Skip to content

Commit

Permalink
Fix batch numbers computation. fixes gh-25
Browse files Browse the repository at this point in the history
  • Loading branch information
frapell committed Sep 2, 2021
1 parent 286565d commit 5c9320a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions news/25.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix batch numbers computation
[frapell]
6 changes: 3 additions & 3 deletions plone/formwidget/recurrence/browser/json_recurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ def json_string(self):
cur_batch = cur_batch - first_batch
# correct number of occurrences in current batch
(cur_batch_start, cur_batch_end) = batches[cur_batch]
if cur_batch_end > len(occurrences):
batches[cur_batch] = (cur_batch_start, len(occurrences))
if cur_batch_end > num_occurrences:
batches[cur_batch] = (cur_batch_start, num_occurrences)

batch_data = {'start': start,
'end': num_occurrences,
'batch_size': batch_size,
'batches': batches,
'currentBatch': cur_batch - first_batch,
'currentBatch': cur_batch,
}

result = {'occurrences': occurrences, 'batch': batch_data}
Expand Down

0 comments on commit 5c9320a

Please sign in to comment.