From fdf0108a481c4e15fa93b8f16ab1658ee484c8d2 Mon Sep 17 00:00:00 2001 From: Adam Allen Date: Sat, 16 Jan 2016 00:33:58 +0000 Subject: [PATCH] adjust mash temp (useful when creating new recipes) --- commander/cloud/cloudNG.py | 14 ++++++++++++++ commander/metroui/editRecipe.py | 21 ++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/commander/cloud/cloudNG.py b/commander/cloud/cloudNG.py index 4722933..24f6507 100644 --- a/commander/cloud/cloudNG.py +++ b/commander/cloud/cloudNG.py @@ -207,6 +207,19 @@ def listBrewlogsByRecipe(self,username,recipeName,raw=False): + def setMashTemp(self,username,recipeName, newMashTemp,doRecalculate="1"): + if 1==1: + # flag recipe rcalc at the recipe level + ourRecipe = self.dbWrapper.GqlQuery("SELECT * FROM gRecipes WHERE owner = :1 AND recipename = :2", username,recipeName) + for recipe in ourRecipe.fetch(500): + if not doRecalculate == "1": + recipe.calculationOutstanding=True + recipe.target_mash_temp=float(newMashTemp) + recipe.put() + if doRecalculate == "1": + self.calculateRecipe(username,recipeName) + self.compile(username,recipeName,None) + def setMashEfficiency(self,username,recipeName, newMashEfficiency,doRecalculate="1"): if 1==1: # flag recipe rcalc at the recipe level @@ -3187,6 +3200,7 @@ def createBlankRecipe(self,username,recipeNewName): R=gRecipes(recipename=recipeNewName,owner=username ) R.mash_grain_ratio=1.5 + R.target_mash_temp=67.5 R.mash_efficiency=70 R.priming_sugar_qty=2 R.alkalinity = 50 diff --git a/commander/metroui/editRecipe.py b/commander/metroui/editRecipe.py index 9c06b6f..009a67d 100644 --- a/commander/metroui/editRecipe.py +++ b/commander/metroui/editRecipe.py @@ -152,10 +152,10 @@ def displayRecipe(self):

""" %(self.activeStats) cursor=con.cursor() - cursor.execute("select recipeName,process,mash_efficiency,alkalinity from gRecipes WHERE recipeName = '%s' ;" %(self.recipeName)) + cursor.execute("select recipeName,process,target_mash_temp,mash_efficiency,alkalinity from gRecipes WHERE recipeName = '%s' ;" %(self.recipeName)) mashEfficiency=0 for row in cursor: - (recipeName,process,mashEfficiency,alkalinity)=row + (recipeName,process,target_mash_temp,mashEfficiency,alkalinity)=row cursor=db.query ("select recipe,estimated_og,estimated_fg,estimated_abv,estimated_ibu,topupvol,boil_vol,batchsize from gRecipeStats WHERE recipe='%s' AND process = '%s' ORDER BY entity DESC LIMIT 0,1" %(recipeName,process)) result=db.use_result() row=result.fetch_row() @@ -185,6 +185,15 @@ def displayRecipe(self): print "Batch Size: %.1f L
" %(float(batchsize)) if self.editable: + print "Target Mash Temp: " + print """
""" print "Mash Efficiency: " print """
""" else: + print "Target Mash Temp: %.1f'C
" %(float(target_mash_temp)) print "Mash Efficiency: %.0f %%
" %(float(mashEfficiency)) @@ -662,6 +672,11 @@ def hops(self,hopAddAtA,hopAddAtB): } + function adjustMashTemp(){ + + url="editIngredient.py?recipe=%s&type=null&action=changeMashTemp&mashtemp="+document.getElementById('mashtemp').value; + window.location.replace(url); + } function adjustMashEfficiency(){ url="editIngredient.py?recipe=%s&type=null&action=changeMashEfficiency&mashefficiency="+document.getElementById('efficiency').value; window.location.replace(url); @@ -703,7 +718,7 @@ def hops(self,hopAddAtA,hopAddAtB): document.getElementById(itemtype+'QtyCell'+i).innerHTML=html; } - """ %(form['recipeName'].value,form['recipeName'].value,form['recipeName'].value,form['recipeName'].value,form['recipeName'].value) + """ %(form['recipeName'].value,form['recipeName'].value,form['recipeName'].value,form['recipeName'].value,form['recipeName'].value,form['recipeName'].value) print "

"