Skip to content

Instantly share code, notes, and snippets.

@mik3y
Created April 18, 2012 04:57
Show Gist options
  • Save mik3y/2411186 to your computer and use it in GitHub Desktop.
Save mik3y/2411186 to your computer and use it in GitHub Desktop.
Update pykeg drinks
# Manually reset the volume of all drinks in a session.
# You should run this by hand in "kegbot-admin.py shell"
# Be sure to run "kegbot-admin.py kb_regen_stats" after doing so.
ML_PER_TICK = 1.0/2200 # change me
SESSION_ID = 123 # change me
# Should not need to edit past here.
from pykeg.core import models
session = models.DrinkingSession.objects.get(seqn=SESSION)
drinks = session.drinks.all()
print "Adjusting session: %s" % session
for d in drinks:
d.volume_ml = d.ticks * ML_PER_TICK
d.save()
print " + %s" % d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment