diff --git a/app.py b/app.py
index e7aa139..6f847b8 100644
--- a/app.py
+++ b/app.py
@@ -43,16 +43,25 @@ def index():
else:
count = len(alle)
- for i in range(1,count):
+ while count > 1:
if len(alle) == 0:
break
term = alle.pop(random.randint(0,len(alle)-1))
term.c = ''
if request.form.get('gemischteAufgaben'):
maxValue = eval(str(term.a) + term.t.typ + str(term.b))
- term.c += ' + ' if random.randint(0,1) else ' - '
+ if random.randint(0,1):
+ term.c += ' + '
+ t = int(100 - maxValue)
+ maxValue = t
+ else:
+ term.c += ' - '
+ if maxValue <= 1:
+ alle.append(term)
+ continue
term.c += str(random.randint(1,maxValue))
zufall.append(term)
+ count -= 1
return render_template('arbeitsblatt.html',aufgaben=zufall,maxPerPage=int(request.form.get('maxPerPage')))
else:
return render_template('generator.html', reihen=rt_rechenreihen)
diff --git a/templates/generator.html b/templates/generator.html
index 01638d3..e99c064 100644
--- a/templates/generator.html
+++ b/templates/generator.html
@@ -28,12 +28,12 @@
-
+