def addFood(): form = SearchForm() if form.validate_on_submit(): print('asd') food = Food(name=form.name.data, mass=form.mass.data, calories=form.calories.data, protein=form.protein.data, carbohydrates=form.carbohydrates.data, fats=form.fats.data) db.session.add(food) db.session.commit() flash('Your entry has been entered!','success') return render_template('addFood.html', form=form)
def _Food(): form = FoodForm() if form.validate_on_submit(): food = Food(name=form.name.data, mass=form.mass.data) db.session.add(food) db.session.commit() flash('Your entry has been entered!', 'success') r1 = Record('food1') p1 = YourPlan('2500', 'bulk') image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('food.html', items=r1, kcal=p1, image_file=image_file, form=form)
def _Food(): form = FoodForm() if form.validate_on_submit(): food = Food(name=form.name.data, mass=form.mass.data) db.session.add(food) db.session.commit() flash('Your entry has been entered!', 'success') #daily intake mtcalories = (447.593 + (9.247 * current_user.weight) + (3.098 * current_user.height * 100) - (4.33 * current_user.age)) * 1.55 simplifiedmt = round(mtcalories) #food and exercise # totalfood = foodprotein*4 + foodcarb*4 + foodfat*9 # totalexercises = time*(intensity*3.33) # 1 rep = 0.3-0.4cal #daily intake - added food and exercises # recordedcalories = totalfood + totalexercises # simplifiedmt = round(mtcalories) - recordedcalories #macronutrients left protein25 = round(simplifiedmt * 0.25) fat25 = round(simplifiedmt * 0.25) carb50 = round(simplifiedmt * 0.5) cprotein25 = round(protein25 / 4) cfat25 = round(fat25 / 9) ccarb50 = round(carb50 / 4) p1 = YourPlan(simplifiedmt, ccarb50, cprotein25, cfat25) image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('food.html', kcal=p1, image_file=image_file, form=form)
flash('Commit!', 'success') else: searches="" db.session.commit() app.logger.debug(form.meal.data) r1 = Record('food1') p1 = YourPlan('2500', 'bulk') image_file = url_for('static', filename='profile_pics/' + current_user.image_file) return render_template('food.html', items=r1, kcal=p1, image_file=image_file, form=form, searches=searches) ======= form = FoodForm() if form.validate_on_submit(): food = Food(name=form.name.data, mass=form.mass.data) db.session.add(food) db.session.commit() flash('Your entry has been entered!', 'success') #daily intake mtcalories = (447.593 + (9.247 * current_user.weight) + (3.098 * current_user.height *100) - (4.33 * current_user.age))*1.55 simplifiedmt = round(mtcalories) #food and exercise # totalfood = foodprotein*4 + foodcarb*4 + foodfat*9 # totalexercises = time*(intensity*3.33) # 1 rep = 0.3-0.4cal #daily intake - added food and exercises # recordedcalories = totalfood + totalexercises