Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

Commit

Permalink
adjust mash temp (useful when creating new recipes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Allen committed Jan 16, 2016
1 parent 48534b8 commit fdf0108
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
14 changes: 14 additions & 0 deletions commander/cloud/cloudNG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 18 additions & 3 deletions commander/metroui/editRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ def displayRecipe(self):
<p>
""" %(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()
Expand Down Expand Up @@ -185,6 +185,15 @@ def displayRecipe(self):
print "<b>Batch Size:</b> %.1f L<BR>" %(float(batchsize))

if self.editable:
print "<b>Target Mash Temp:</b> <select id='mashtemp'>"
for c in range(10):
selected=""

if float(target_mash_temp) <= float(c+61) and float(target_mash_temp) > float(c+60):
selected="SELECTED"
print "<option value='%s' %s>%s %%</option>" %(c+61,selected,c+61)
print "</select>"
print """<a href='javascript:adjustMashTemp()'><i class="icon-checkmark fg-blue"></i></a><br>"""
print "<b>Mash Efficiency:</b> <select id='efficiency'>"
for c in range(40):
selected=""
Expand All @@ -194,6 +203,7 @@ def displayRecipe(self):
print "</select>"
print """<a href='javascript:adjustMashEfficiency()'><i class="icon-checkmark fg-blue"></i></a><br>"""
else:
print "<b>Target Mash Temp:</b> %.1f'C<br>" %(float(target_mash_temp))
print "<b>Mash Efficiency:</b> %.0f %%<br>" %(float(mashEfficiency))


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -703,7 +718,7 @@ def hops(self,hopAddAtA,hopAddAtB):
document.getElementById(itemtype+'QtyCell'+i).innerHTML=html;
}
</script>
""" %(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 "<div class=\"container\">"
Expand Down

0 comments on commit fdf0108

Please sign in to comment.