From e675a9587186e3b598ce1e0aa2f7c00578d14401 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 8 Jul 2014 16:27:06 +0200 Subject: [PATCH] have a fixed batch size of 12 --- knowledge/survey/browser.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/knowledge/survey/browser.py b/knowledge/survey/browser.py index 0607ca3..93119d8 100644 --- a/knowledge/survey/browser.py +++ b/knowledge/survey/browser.py @@ -44,7 +44,7 @@ class SurveyView(ConceptView): data = None errors = None - minBatchSize = 10 + batchSize = 12 teamData = None @Lazy @@ -64,9 +64,8 @@ class SurveyView(ConceptView): questions = list(self.adapted.questions) questions.sort(key=lambda x: x.title) size = len(questions) - nb = size / self.minBatchSize - rem = size % self.minBatchSize - bs = self.minBatchSize + ((rem + self.minBatchSize) / nb) + #nb, rem = divmod(size, self.batchSize) + bs = self.batchSize for idx in range(0, size, bs): result.append(dict(title=u'Question', infoText=None, questions=questions[idx:idx+bs]))