have a fixed batch size of 12
This commit is contained in:
parent
527c2f445d
commit
e675a95871
1 changed files with 3 additions and 4 deletions
|
@ -44,7 +44,7 @@ class SurveyView(ConceptView):
|
||||||
|
|
||||||
data = None
|
data = None
|
||||||
errors = None
|
errors = None
|
||||||
minBatchSize = 10
|
batchSize = 12
|
||||||
teamData = None
|
teamData = None
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
|
@ -64,9 +64,8 @@ class SurveyView(ConceptView):
|
||||||
questions = list(self.adapted.questions)
|
questions = list(self.adapted.questions)
|
||||||
questions.sort(key=lambda x: x.title)
|
questions.sort(key=lambda x: x.title)
|
||||||
size = len(questions)
|
size = len(questions)
|
||||||
nb = size / self.minBatchSize
|
#nb, rem = divmod(size, self.batchSize)
|
||||||
rem = size % self.minBatchSize
|
bs = self.batchSize
|
||||||
bs = self.minBatchSize + ((rem + self.minBatchSize) / nb)
|
|
||||||
for idx in range(0, size, bs):
|
for idx in range(0, size, bs):
|
||||||
result.append(dict(title=u'Question', infoText=None,
|
result.append(dict(title=u'Question', infoText=None,
|
||||||
questions=questions[idx:idx+bs]))
|
questions=questions[idx:idx+bs]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue