Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add first rough versions of calories and bmi calculator

Roland Geiderb491411125d3
diff --git a/wger/manager/migrations/0006_auto__add_field_userprofile_age__add_field_userprofile_height__add_fie.py b/wger/manager/migrations/0006_auto__add_field_userprofile_age__add_field_userprofile_height__add_fie.py
new file mode 100644
index 000000000..91a7bd936
--- /dev/null
+++ b/wger/manager/migrations/0006_auto__add_field_userprofile_age__add_field_userprofile_height__add_fie.py
@@ -0,0 +1,253 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding field 'UserProfile.age'
+ db.add_column(u'manager_userprofile', 'age',
+ self.gf('django.db.models.fields.IntegerField')(max_length=2, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.height'
+ db.add_column(u'manager_userprofile', 'height',
+ self.gf('django.db.models.fields.IntegerField')(max_length=2, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.gender'
+ db.add_column(u'manager_userprofile', 'gender',
+ self.gf('django.db.models.fields.CharField')(default='1', max_length=1, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.sleep_hours'
+ db.add_column(u'manager_userprofile', 'sleep_hours',
+ self.gf('django.db.models.fields.IntegerField')(default=7, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.work_hours'
+ db.add_column(u'manager_userprofile', 'work_hours',
+ self.gf('django.db.models.fields.IntegerField')(default=8, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.work_intensity'
+ db.add_column(u'manager_userprofile', 'work_intensity',
+ self.gf('django.db.models.fields.CharField')(default='1', max_length=1, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.sport_hours'
+ db.add_column(u'manager_userprofile', 'sport_hours',
+ self.gf('django.db.models.fields.IntegerField')(default=3, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.sport_intensity'
+ db.add_column(u'manager_userprofile', 'sport_intensity',
+ self.gf('django.db.models.fields.CharField')(default='2', max_length=1, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.freetime_hours'
+ db.add_column(u'manager_userprofile', 'freetime_hours',
+ self.gf('django.db.models.fields.IntegerField')(default=8, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.freetime_intensity'
+ db.add_column(u'manager_userprofile', 'freetime_intensity',
+ self.gf('django.db.models.fields.CharField')(default='1', max_length=1, null=True),
+ keep_default=False)
+
+ # Adding field 'UserProfile.calories'
+ db.add_column(u'manager_userprofile', 'calories',
+ self.gf('django.db.models.fields.IntegerField')(default=2500, null=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting field 'UserProfile.age'
+ db.delete_column(u'manager_userprofile', 'age')
+
+ # Deleting field 'UserProfile.height'
+ db.delete_column(u'manager_userprofile', 'height')
+
+ # Deleting field 'UserProfile.gender'
+ db.delete_column(u'manager_userprofile', 'gender')
+
+ # Deleting field 'UserProfile.sleep_hours'
+ db.delete_column(u'manager_userprofile', 'sleep_hours')
+
+ # Deleting field 'UserProfile.work_hours'
+ db.delete_column(u'manager_userprofile', 'work_hours')
+
+ # Deleting field 'UserProfile.work_intensity'
+ db.delete_column(u'manager_userprofile', 'work_intensity')
+
+ # Deleting field 'UserProfile.sport_hours'
+ db.delete_column(u'manager_userprofile', 'sport_hours')
+
+ # Deleting field 'UserProfile.sport_intensity'
+ db.delete_column(u'manager_userprofile', 'sport_intensity')
+
+ # Deleting field 'UserProfile.freetime_hours'
+ db.delete_column(u'manager_userprofile', 'freetime_hours')
+
+ # Deleting field 'UserProfile.freetime_intensity'
+ db.delete_column(u'manager_userprofile', 'freetime_intensity')
+
+ # Deleting field 'UserProfile.calories'
+ db.delete_column(u'manager_userprofile', 'calories')
+
+
+ models = {
+ u'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ u'auth.permission': {
+ 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ u'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ u'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ u'exercises.exercise': {
+ 'Meta': {'ordering': "['name']", 'object_name': 'Exercise'},
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exercises.ExerciseCategory']"}),
+ 'creation_date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'max_length': '2000'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exercises.Language']"}),
+ 'muscles': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['exercises.Muscle']", 'symmetrical': 'False'}),
+ 'muscles_secondary': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'secondary_muscles'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['exercises.Muscle']"}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'status': ('django.db.models.fields.CharField', [], {'default': "'1'", 'max_length': '2'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'})
+ },
+ u'exercises.exercisecategory': {
+ 'Meta': {'ordering': "['name']", 'object_name': 'ExerciseCategory'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ u'exercises.language': {
+ 'Meta': {'object_name': 'Language'},
+ 'full_name': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'short_name': ('django.db.models.fields.CharField', [], {'max_length': '2'})
+ },
+ u'exercises.muscle': {
+ 'Meta': {'ordering': "['name']", 'object_name': 'Muscle'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_front': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ u'manager.day': {
+ 'Meta': {'ordering': "['day__id']", 'object_name': 'Day'},
+ 'day': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['manager.DaysOfWeek']", 'symmetrical': 'False'}),
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'training': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Workout']"})
+ },
+ u'manager.daysofweek': {
+ 'Meta': {'object_name': 'DaysOfWeek'},
+ 'day_of_week': ('django.db.models.fields.CharField', [], {'max_length': '9'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ u'manager.schedule': {
+ 'Meta': {'object_name': 'Schedule'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_loop': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'start_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
+ },
+ u'manager.schedulestep': {
+ 'Meta': {'ordering': "['order']", 'object_name': 'ScheduleStep'},
+ 'duration': ('django.db.models.fields.IntegerField', [], {'default': '4', 'max_length': '1'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {'default': '1', 'max_length': '1'}),
+ 'schedule': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Schedule']"}),
+ 'workout': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Workout']"})
+ },
+ u'manager.set': {
+ 'Meta': {'ordering': "['order']", 'object_name': 'Set'},
+ 'exerciseday': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Day']"}),
+ 'exercises': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['exercises.Exercise']", 'symmetrical': 'False'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
+ 'sets': ('django.db.models.fields.IntegerField', [], {'default': '4'})
+ },
+ u'manager.setting': {
+ 'Meta': {'ordering': "['order', 'id']", 'object_name': 'Setting'},
+ 'comment': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+ 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exercises.Exercise']"}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {'blank': 'True'}),
+ 'reps': ('django.db.models.fields.IntegerField', [], {}),
+ 'set': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Set']"})
+ },
+ u'manager.userprofile': {
+ 'Meta': {'object_name': 'UserProfile'},
+ 'age': ('django.db.models.fields.IntegerField', [], {'max_length': '2', 'null': 'True'}),
+ 'calories': ('django.db.models.fields.IntegerField', [], {'default': '2500', 'null': 'True'}),
+ 'freetime_hours': ('django.db.models.fields.IntegerField', [], {'default': '8', 'null': 'True'}),
+ 'freetime_intensity': ('django.db.models.fields.CharField', [], {'default': "'1'", 'max_length': '1', 'null': 'True'}),
+ 'gender': ('django.db.models.fields.CharField', [], {'default': "'1'", 'max_length': '1', 'null': 'True'}),
+ 'height': ('django.db.models.fields.IntegerField', [], {'max_length': '2', 'null': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'show_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'show_english_ingredients': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'sleep_hours': ('django.db.models.fields.IntegerField', [], {'default': '7', 'null': 'True'}),
+ 'sport_hours': ('django.db.models.fields.IntegerField', [], {'default': '3', 'null': 'True'}),
+ 'sport_intensity': ('django.db.models.fields.CharField', [], {'default': "'2'", 'max_length': '1', 'null': 'True'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}),
+ 'work_hours': ('django.db.models.fields.IntegerField', [], {'default': '8', 'null': 'True'}),
+ 'work_intensity': ('django.db.models.fields.CharField', [], {'default': "'1'", 'max_length': '1', 'null': 'True'})
+ },
+ u'manager.workout': {
+ 'Meta': {'ordering': "['-creation_date']", 'object_name': 'Workout'},
+ 'comment': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+ 'creation_date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
+ },
+ u'manager.workoutlog': {
+ 'Meta': {'ordering': "['date', 'reps']", 'object_name': 'WorkoutLog'},
+ 'date': ('django.db.models.fields.DateField', [], {}),
+ 'exercise': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['exercises.Exercise']"}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'reps': ('django.db.models.fields.IntegerField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
+ 'weight': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
+ 'workout': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['manager.Workout']"})
+ }
+ }
+
+ complete_apps = ['manager']
\ No newline at end of file
diff --git a/wger/manager/models.py b/wger/manager/models.py
index dc245f294..902cd8778 100644
--- a/wger/manager/models.py
+++ b/wger/manager/models.py
@@ -27,6 +27,7 @@ from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
+from django.core.exceptions import ValidationError
from django.core.cache import cache
from wger.exercises.models import Exercise
@@ -524,6 +525,25 @@ class WorkoutLog(models.Model):
class UserProfile(models.Model):
+
+ GENDER_MALE = '1'
+ GENDER_FEMALE = '2'
+
+ GENDER = (
+ (GENDER_MALE, _('Male')),
+ (GENDER_FEMALE, _('Female')),
+ )
+
+ INTENSITY_LOW = '1'
+ INTENSITY_MEDIUM = '2'
+ INTENSITY_HIGH = '3'
+
+ INTENSITY = (
+ (INTENSITY_LOW, _('Low')),
+ (INTENSITY_MEDIUM, _('Medium')),
+ (INTENSITY_HIGH, _('High')),
+ )
+
# This field is required.
user = models.OneToOneField(User,
editable=False)
@@ -550,6 +570,99 @@ a nutritional plan. These ingredients are extracted from a list provided
by the US Department of Agriculture. It is extremely complete, with around
7000 entries, but can be somewhat overwhelming and make the search difficult.'''))
+ #
+ # User statistics
+ #
+ age = models.IntegerField(max_length=2,
+ verbose_name=_('Age'),
+ blank=False,
+ null=True)
+ '''The user's age'''
+
+ height = models.IntegerField(max_length=2,
+ verbose_name=_('Height'),
+ help_text=_('Height, in cm.'),
+ blank=False,
+ null=True)
+ '''The user's height'''
+
+ gender = models.CharField(max_length=1,
+ choices=GENDER,
+ default=GENDER_MALE,
+ blank=False,
+ null=True)
+ '''Gender'''
+
+ sleep_hours = models.IntegerField(verbose_name=_('Hours of sleep'),
+ help_text=_('The average hours of sleep per day'),
+ default=7,
+ blank=False,
+ null=True)
+ '''The average hours of sleep per day'''
+
+ work_hours = models.IntegerField(verbose_name=_('Work hours'),
+ help_text=_('The average hours at work per day'),
+ default=8,
+ blank=False,
+ null=True)
+ '''The average hours at work per day'''
+
+ work_intensity = models.CharField(verbose_name=_('Intensity of work'),
+ help_text=_('Physical intensity of the work'),
+ max_length=1,
+ choices=INTENSITY,
+ default=INTENSITY_LOW,
+ blank=False,
+ null=True)
+ '''Physical intensity of work'''
+
+ sport_hours = models.IntegerField(verbose_name=_('Sport hours'),
+ help_text=_('The average hours performing sports per week'),
+ default=3,
+ blank=False,
+ null=True)
+ '''The average hours performing sports per week'''
+
+ sport_intensity = models.CharField(verbose_name=_('Intensity of sport activities'),
+ help_text=_('Physical intensity of sport activities'),
+ max_length=1,
+ choices=INTENSITY,
+ default=INTENSITY_MEDIUM,
+ blank=False,
+ null=True)
+ '''Physical intensity of sport activities'''
+
+ freetime_hours = models.IntegerField(verbose_name=_('Hours of free time'),
+ help_text=_('The average hours of free time per day'),
+ default=8,
+ blank=False,
+ null=True)
+ '''The average hours of free time per day'''
+
+ freetime_intensity = models.CharField(verbose_name=_('Intensity'),
+ help_text=_('Physical intensity during free time'),
+ max_length=1,
+ choices=INTENSITY,
+ default=INTENSITY_LOW,
+ blank=False,
+ null=True)
+ '''Physical intensity during free time'''
+
+ calories = models.IntegerField(verbose_name=_('Basic caloric intake'),
+ help_text=_('Basic caloric intake based on physical activity'),
+ default=2500,
+ blank=False,
+ null=True)
+ '''Basic caloric intake based on physical activity'''
+
+ def clean(self):
+ '''
+ Make sure the total amount of hours is 24
+ '''
+
+ if (self.sleep_hours + self.freetime_hours + self.work_hours) > 24:
+ raise ValidationError(_('The sum of all hours has to be 24'))
+
def __unicode__(self):
'''
Return a more human-readable representation
diff --git a/wger/manager/static/images/SOURCES b/wger/manager/static/images/SOURCES
index a2471ce25..30f3d47ff 100644
--- a/wger/manager/static/images/SOURCES
+++ b/wger/manager/static/images/SOURCES
@@ -1,3 +1,4 @@
loader.svg: http://jorgecardoso.eu/htmlblog/2012-10-07-Scalable%20Ajax%20Loading%20Indicator%20in%20SVG.html
agpl-v3.svg: https://www.gnu.org/graphics/license-logos
cc-by-sa.svg: https://creativecommons.org/about/downloads
+bmi.svg https://commons.wikimedia.org/wiki/File:BodyMassIndex.svg
diff --git a/wger/manager/static/images/bmi.svg b/wger/manager/static/images/bmi.svg
new file mode 100644
index 000000000..474b57d6a
--- /dev/null
+++ b/wger/manager/static/images/bmi.svg
@@ -0,0 +1,520 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="479"
+ height="300"
+ id="svg4136"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="bmi.svg"
+ inkscape:export-filename="D:\Jochens Kram\Merkur Akademie\Biologie\Bilder\Ernährung\BMI-Grafik.png"
+ inkscape:export-xdpi="300"
+ inkscape:export-ydpi="300"
+ viewBox="0 0 479 300">
+ <defs
+ id="defs4138">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective4144" />
+ <inkscape:perspective
+ id="perspective4076"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4076-8"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4396"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4396-3"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4432"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4457"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4482"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4482-6"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4482-3"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective4482-2"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5056"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5056-7"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5056-3"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5100"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5100-0"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5100-06"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5152"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5152-9"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5152-7"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5235"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective5402"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective3056"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_z="1 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="443.9458"
+ inkscape:cy="114.38614"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1131"
+ inkscape:window-height="695"
+ inkscape:window-x="229"
+ inkscape:window-y="54"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata4141">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(112.10824,-194.90909)">
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-53.11137"
+ y="479.40689"
+ id="text2846-17"><tspan
+ sodipodi:role="line"
+ id="tspan2848-4"
+ x="-53.11137"
+ y="479.40689"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">1,60</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="47.355091"
+ y="479.40689"
+ id="text2846-1-0"><tspan
+ sodipodi:role="line"
+ id="tspan2848-7-9"
+ x="47.355091"
+ y="479.40689"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">1,70</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="147.35506"
+ y="479.40689"
+ id="text2846-0-4"><tspan
+ sodipodi:role="line"
+ id="tspan2848-9-8"
+ x="147.35506"
+ y="479.40689"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">1,80</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="247.35512"
+ y="479.40689"
+ id="text2846-8-8"><tspan
+ sodipodi:role="line"
+ id="tspan2848-2-2"
+ x="247.35512"
+ y="479.40689"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">1,90</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="347.35507"
+ y="479.40689"
+ id="text2846-5-4"><tspan
+ sodipodi:role="line"
+ id="tspan2848-1-5"
+ x="347.35507"
+ y="479.40689"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">2,00</tspan></text>
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -2.23997,461.20239 0,-265.34105"
+ id="path3680-7-5" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 47.75526,461.20239 0,-265.34101"
+ id="path3680-1-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 97.7505,461.20239 0,-265.34108"
+ id="path3680-2-7" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 147.74573,461.20239 0,-265.34102"
+ id="path3680-6-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 197.74096,461.20239 0,-265.34101"
+ id="path3680-23-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 247.7362,461.20239 0,-265.341"
+ id="path3680-21-5" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 297.73143,461.20239 0,-265.34099"
+ id="path3680-8-2" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 347.72666,461.20239 0,-265.34105"
+ id="path3680-61-7" />
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="453.14713"
+ id="text2846-89-6"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-14"
+ x="-77.787704"
+ y="453.14713"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">40</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="423.14178"
+ id="text2846-89-9-2"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-5-3"
+ x="-77.787704"
+ y="423.14178"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">50</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="393.14166"
+ id="text2846-89-3-2"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-1-2"
+ x="-77.787704"
+ y="393.14166"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">60</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="363.14166"
+ id="text2846-89-33-1"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-4-6"
+ x="-77.787704"
+ y="363.14166"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">70</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="333.14166"
+ id="text2846-89-1-8"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-3-5"
+ x="-77.787704"
+ y="333.14166"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">80</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-77.787704"
+ y="303.14163"
+ id="text2846-89-7-7"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-42-6"
+ x="-77.787704"
+ y="303.14163"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">90</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-83.510361"
+ y="272.96835"
+ id="text2846-89-79-1"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-31-8"
+ x="-83.510361"
+ y="272.96835"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">100</tspan><tspan
+ sodipodi:role="line"
+ x="-83.510361"
+ y="297.96835"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed"
+ id="tspan3966-9" /></text>
+ <text
+ xml:space="preserve"
+ style="font-size:15px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-83.510361"
+ y="242.9323"
+ id="text2846-89-8-2"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-6-7"
+ x="-83.510361"
+ y="242.9323"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">110</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-83.510361"
+ y="212.9323"
+ id="text2846-89-0-9"><tspan
+ sodipodi:role="line"
+ id="tspan2848-27-2-5"
+ x="-83.510361"
+ y="212.9323"
+ style="font-size:15px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">120</tspan></text>
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,415.83209 423.96104,0"
+ id="path3894-43" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,385.84185 423.96104,0"
+ id="path3894-8-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,355.85161 423.96104,0"
+ id="path3894-0-2" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,325.86137 423.96104,0"
+ id="path3894-4-3" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,295.87113 423.96104,0"
+ id="path3894-6-34" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,265.88089 423.96104,0"
+ id="path3894-6-0-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,235.89065 423.96104,0"
+ id="path3894-6-6-1" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,205.90041 423.96104,0"
+ id="path3894-6-3-3" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.25567627;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -66.21531,445.82239 423.96104,0"
+ id="path3894-09-8" />
+ <path
+ style="fill:#808080;stroke:#000000;stroke-width:1.26277387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m -52.2352,461.20239 0,-265.34102"
+ id="path3680-74" />
+ <path
+ style="opacity:0.5;fill:#000080;stroke:none"
+ d="m -62.25427,455.86139 0,-11.349 c 0,0 140.11484,-22.0961 210,-34.171 70.12195,-12.1159 210,-38.40502 210,-38.40502 l 0,83.92502 -420,0 z"
+ id="path4038-2"
+ sodipodi:nodetypes="ccsccc" />
+ <path
+ style="opacity:0.5;fill:#0000ff;stroke:none"
+ d="m -62.25427,444.51239 0,-7.584 c 0,0 140.09986,-23.6406 210,-36.307 70.10471,-12.70348 210,-39.80502 210,-39.80502 l 0,11.12 c 0,0 -139.87805,26.28912 -210,38.40502 -69.88516,12.0749 -210,34.171 -210,34.171 z"
+ id="path4044-7"
+ sodipodi:nodetypes="ccsccsc" />
+ <path
+ style="opacity:0.5;fill:#00ffff;stroke:none"
+ d="m 357.74573,341.63537 0,19.181 c 0,0 -139.89529,27.10154 -210,39.80502 -69.90014,12.6664 -210,36.307 -210,36.307 l 0,-11.377 c 0,0 140.15202,-25.5562 210,-39.51002 70.16152,-14.01644 210,-44.406 210,-44.406 z"
+ id="path4046-7"
+ sodipodi:nodetypes="ccsccsc" />
+ <path
+ style="opacity:0.5;fill:#00ff00;stroke:none"
+ d="m -61.89713,426.93279 -0.35714,-50.67942 c 0,0 140.26882,-34.56893 210,-53.392 70.28611,-18.97286 210,-60.008 210,-60.008 l 0,78.782 c 0,0 -139.83848,30.38956 -210,44.406 -69.84798,13.95382 -210,39.51002 -210,39.51002"
+ id="path4048-9"
+ sodipodi:nodetypes="ccsccsc" />
+ <path
+ style="opacity:0.5;fill:#ffff00;stroke:none"
+ d="m -62.25427,376.25337 0,-37.921 c 0,0 140.3755,-41.51995 210,-64.071 70.40027,-22.80231 210,-72.009 210,-72.009 l 0,60.601 c 0,0 -139.71389,41.03514 -210,60.008 -69.73118,18.82307 -210,53.392 -210,53.392 z"
+ id="path4050-3"
+ sodipodi:nodetypes="ccsccsc" />
+ <path
+ style="opacity:0.5;fill:#ff7f2a;stroke:none"
+ d="m -61.85072,338.28013 -0.40355,-37.86976 c 0,0 106.92006,-36.70055 160,-56.112 42.60459,-15.58059 127.181,-48.437 127.181,-48.437 l 132.819,0 0,6.391 c 0,0 -139.60326,49.1958 -210,72.009 -69.49379,22.52059 -209.59645,64.01876 -209.59645,64.01876 z"
+ id="path4054-1"
+ sodipodi:nodetypes="ccscccsc" />
+ <path
+ style="opacity:0.5;fill:#ff2a2a;stroke:none"
+ d="m -62.25427,300.41037 0,-37.921 c 0,0 73.45853,-28.63882 110,-43.428 18.71282,-7.57351 55.942,-23.2 55.942,-23.2 l 121.239,0 c 0,0 -84.57641,32.85641 -127.181,48.437 -53.07994,19.41145 -160,56.112 -160,56.112 z"
+ id="path4058-9"
+ sodipodi:nodetypes="ccsccsc" />
+ <path
+ style="opacity:0.5;fill:#800000;stroke:none"
+ d="m 103.68773,195.86137 c 0,0 -37.22918,15.62649 -55.942,23.2 -36.54147,14.78918 -110,43.428 -110,43.428 l 0,-66.628 165.942,0 z"
+ id="path4064-8"
+ sodipodi:nodetypes="csccc" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 357.74573,455.86139 -420,0 0,-260.00002 420,0 0,260.00002"
+ id="path4066-6" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="148.45383"
+ y="493.32706"
+ id="text5390"><tspan
+ sodipodi:role="line"
+ id="tspan5392"
+ x="148.45383"
+ y="493.32706"
+ style="font-size:12px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">m</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Maiandra GD;-inkscape-font-specification:Maiandra GD"
+ x="-325.2962"
+ y="-102.99105"
+ id="text5390-9"
+ transform="matrix(0,-1,1,0,0,0)"><tspan
+ sodipodi:role="line"
+ id="tspan5392-6"
+ x="-325.2962"
+ y="-102.99105"
+ style="font-size:12px;font-family:DejaVu Sans Condensed;-inkscape-font-specification:DejaVu Sans Condensed">kg</tspan></text>
+ </g>
+</svg>
diff --git a/wger/manager/templates/navigation.html b/wger/manager/templates/navigation.html
index 91ff6d913..5f55576ef 100644
--- a/wger/manager/templates/navigation.html
+++ b/wger/manager/templates/navigation.html
@@ -84,6 +84,8 @@
<ul class="dropdown-menu">
<li><a href="{% url 'wger.nutrition.views.plan.overview' %}" rel="nofollow">{% trans "Nutrition plans" %}</a></li>
<li><a href="{% url 'ingredient-list' %}">{% trans "Ingredient overview" %}</a></li>
+ <li><a href="{% url 'bmi-view' %}">{% trans "BMI Calculator" %}</a></li>
+ <li><a href="{% url 'calories-calculator' %}">{% trans "Daily calories calculator" %}</a></li>
{% cache cache_timeout user-admin-ingredients user.id language.id %}
{% if perms.exercises %}
<li class="divider"></li>
diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py
index 83a2943b5..4bd136c0a 100644
--- a/wger/nutrition/forms.py
+++ b/wger/nutrition/forms.py
@@ -19,6 +19,8 @@ import logging
from django import forms
from wger.nutrition.models import IngredientWeightUnit
+from wger.manager.models import UserProfile
+
logger = logging.getLogger('wger.custom')
@@ -48,3 +50,46 @@ class UnitChooserForm(forms.Form):
self.fields['unit'].queryset = IngredientWeightUnit.objects.filter(
ingredient_id=ingredient_id).select_related()
+
+
+class BmiForm(forms.ModelForm):
+ weight = forms.IntegerField()
+
+ class Meta:
+ model = UserProfile
+ fields = ('height', )
+
+
+class BmrForm(forms.ModelForm):
+ '''
+ Form for the basal metabolic rate
+ '''
+ weight = forms.IntegerField()
+
+ class Meta:
+ model = UserProfile
+ fields = ('age', 'height', 'gender')
+
+
+class PhysicalActivitiesForm(forms.ModelForm):
+ '''
+ Form for the additional physical activities
+ '''
+ class Meta:
+ model = UserProfile
+ fields = ('sleep_hours',
+ 'work_hours',
+ 'work_intensity',
+ 'sport_hours',
+ 'sport_intensity',
+ 'freetime_hours',
+ 'freetime_intensity')
+
+
+class DailyCaloriesForm(forms.ModelForm):
+ '''
+ Form for the total daily calories needed
+ '''
+ class Meta:
+ model = UserProfile
+ fields = ('calories',)
diff --git a/wger/nutrition/models.py b/wger/nutrition/models.py
index b514376be..a1400b800 100644
--- a/wger/nutrition/models.py
+++ b/wger/nutrition/models.py
@@ -242,8 +242,8 @@ class Ingredient(models.Model):
(self.fat * 9))
# Compare the values, but be generous
- energy_upper = self.energy * (1 + (self.ENERGY_APPROXIMATION/decimal.Decimal('100.0')))
- energy_lower = self.energy * (1 - (self.ENERGY_APPROXIMATION/decimal.Decimal('100.0')))
+ energy_upper = self.energy * (1 + (self.ENERGY_APPROXIMATION / decimal.Decimal('100.0')))
+ energy_lower = self.energy * (1 - (self.ENERGY_APPROXIMATION / decimal.Decimal('100.0')))
#logger.debug("{0} > {1} > {2}".format(energy_upper, energy_calculated, energy_lower))
if not ((energy_upper > energy_calculated) and (energy_calculated > energy_lower)):
@@ -542,3 +542,16 @@ class MealItem(models.Model):
item_weight / 100
return nutritional_info
+
+ def get_nutritional_values_percent(self):
+ '''
+ Calculates the percentage each macronutrients contribute to the
+ total energy (approximation, since the factors 4, 4 and 9 are only
+ a rule of thumb)
+ '''
+ values = self.get_nutritional_values()
+ result = {'protein': values['energy'] / values['protein'] * 4,
+ 'carbohydrates': values['energy'] / values['carbohydrates'] * 4,
+ 'fat': values['energy'] / values['fat'] * 9}
+
+ return result
diff --git a/wger/nutrition/templates/bmi/form.html b/wger/nutrition/templates/bmi/form.html
new file mode 100644
index 000000000..e03c1b99f
--- /dev/null
+++ b/wger/nutrition/templates/bmi/form.html
@@ -0,0 +1,191 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+{% block header %}
+<style>
+div.table {
+ display:table;
+ margin-top: 1em;
+}
+div.table > div {
+ display:table-row;
+}
+div.table > div > div {
+ display:table-cell;
+ padding-left: 1em;
+ /*width:50%;*/
+}
+div.bmi-legend {
+ width:1em;
+ height:1em;
+}
+</style>
+
+<script>
+$(document).ready(function() {
+
+ $("#bmi-form").click(function(e){
+ e.preventDefault();
+ var url = $("#bmi-form").attr( 'action' );
+
+ $.post(url,
+ $("#bmi-form").serialize(),
+ function(data) {
+ console.log(data);
+
+ $('#bmi-result-container').show();
+ $('#bmi-result-value').html(data.bmi);
+
+ //$('.result').html(data);
+ });
+ });
+
+ });
+</script>
+{% endblock %}
+
+<!--
+ Title
+-->
+{% block title %}{% trans "BMI calculator" %}{% endblock %}
+
+
+<!--
+ Main Content
+-->
+{% block content %}
+<form action="{% url 'bmi-calculate' %}"
+ method="post"
+ class="ym-form"
+ id="bmi-form">
+{% csrf_token %}
+
+{% if form.non_field_errors %}
+<div class="ym-fbox-text ym-error">
+ {% for error in form.non_field_errors %}
+ <p class="ym-message">{% trans error %}</p>
+ {% endfor %}
+</div>
+{% endif %}
+
+<table>
+ {% for current_field in form %}
+ {% if current_field.name in select_lists %}
+ {% yaml_form_field current_field "ym-fbox-select" %}
+ {% else %}
+ {% yaml_form_field current_field %}
+ {% endif %}
+ {% endfor %}
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="{% trans 'Calculate' %}" id="form-save">
+ </td>
+ </tr>
+</table>
+</form>
+
+<div id="bmi-result-container" style="display:hidden;">
+ <h3>{% trans 'Results' %}</h3>
+ <p>{% trans 'You BMI is: ' %} <span id="bmi-result-value">-/-</span></p>
+</div>
+
+
+<div class="ym-grid linearize-level-1">
+ <div class="ym-g75 ym-gl">
+ <div class="ym-gbox-left">
+ <img width="479"
+ height="300"
+ title="{% trans 'BMI' %}"
+ alt="{% trans 'BMI' %}"
+ src="{% static 'images/bmi.svg' %}"
+ style="margin-top:3em;"></img>
+ </div>
+ </div>
+ <div class="ym-g25 ym-gl">
+ <div class="ym-gbox-left">
+ <h3>{% trans "Legend" %}</h3>
+ <div class="table">
+ <div>
+ <div><div class="bmi-legend" style="background-color:#800000;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad III" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ff0000;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad II" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ff7f2a;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad I" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ffff00;">&nbsp;</div></div>
+ <div>{% trans "Übergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#00ff00;">&nbsp;</div></div>
+ <div>{% trans "Normalgewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#00ffff;">&nbsp;</div></div>
+ <div>{% trans "Leichtes Untergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#0000ff;">&nbsp;</div></div>
+ <div>{% trans "Mäßiges Untergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#000080;">&nbsp;</div></div>
+ <div>{% trans "Starkes Untergewicht" %}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+
+<h3>{% trans "Legend" %}</h3>
+<div class="table">
+ <div>
+ <div><div class="bmi-legend" style="background-color:#800000;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad III" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ff0000;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad II" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ff7f2a;">&nbsp;</div></div>
+ <div>{% trans "Adipositas Grad I" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#ffff00;">&nbsp;</div></div>
+ <div>{% trans "Übergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#00ff00;">&nbsp;</div></div>
+ <div>{% trans "Normalgewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#00ffff;">&nbsp;</div></div>
+ <div>{% trans "Leichtes Untergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#0000ff;">&nbsp;</div></div>
+ <div>{% trans "Mäßiges Untergewicht" %}</div>
+ </div>
+ <div>
+ <div><div class="bmi-legend" style="background-color:#000080;">&nbsp;</div></div>
+ <div>{% trans "Starkes Untergewicht" %}</div>
+ </div>
+</div>
+
+{% endblock %}
+
+
+<!--
+ Side bar
+-->
+{% block sidebar %}{% if sidebar %}{% include sidebar %}{% endif %}{% endblock %}
diff --git a/wger/nutrition/templates/rate/form.html b/wger/nutrition/templates/rate/form.html
new file mode 100644
index 000000000..5a2857da0
--- /dev/null
+++ b/wger/nutrition/templates/rate/form.html
@@ -0,0 +1,159 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% load wger_extras %}
+
+{% block header %}
+<script>
+$(document).ready(function() {
+
+ $("#bmr-form").click(function(e){
+ e.preventDefault();
+ var url = $("#bmr-form").attr( 'action' );
+
+ $.post(url,
+ $("#bmr-form").serialize(),
+ function(data) {
+ //console.log(data);
+
+ $('#bmr-result-container').show();
+ $('#bmr-result-value').html(data.bmr);
+ });
+ });
+
+ $("#activities-form").click(function(e){
+ e.preventDefault();
+ var url = $("#activities-form").attr( 'action' );
+
+ $.post(url,
+ $("#activities-form").serialize(),
+ function(data) {
+ //console.log(data);
+
+ var total = parseFloat($('#bmr-result-value').html()) * data.activities;
+ $('#activities-result-container').show();
+ $('#activities-result-value').html(total);
+
+ //$('.result').html(data);
+ });
+ });
+
+ $("#total-calories-form").click(function(e){
+ e.preventDefault();
+
+ var total = parseInt($('#bmr-result-value').html()) + parseInt($('#activities-result-value').html());
+ $('#id_calories').val(total);
+ });
+
+ });
+</script>
+{% endblock %}
+
+<!--
+ Title
+-->
+{% block title %}{% trans "Daily calories calculator" %}{% endblock %}
+
+
+<!--
+ Main Content
+-->
+{% block content %}
+
+<h3>{%trans "1. Basal metabolic rate" %}</h3>
+<form action="{% url 'calories-calculate' %}"
+ method="post"
+ class="ym-form"
+ id="bmr-form">
+{% csrf_token %}
+
+{% if form.non_field_errors %}
+<div class="ym-fbox-text ym-error">
+ {% for error in form.non_field_errors %}
+ <p class="ym-message">{% trans error %}</p>
+ {% endfor %}
+</div>
+{% endif %}
+
+<table>
+ {% for current_field in form %}
+ {% if current_field.name in select_lists %}
+ {% yaml_form_field current_field "ym-fbox-select" %}
+ {% else %}
+ {% yaml_form_field current_field %}
+ {% endif %}
+ {% endfor %}
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="{% trans 'Calculate' %}" id="form-save">
+ </td>
+ </tr>
+</table>
+</form>
+
+<div id="bmr-result-container" style="display:hidden;">
+ <p>{% trans 'You basic metabolic rate is: ' %} <span id="bmr-result-value">-/-</span></p>
+</div>
+
+
+
+
+<h3>{%trans "2. Activities" %}</h3>
+<form action="{% url 'calories-calculate-activities' %}"
+ method="post"
+ class="ym-form"
+ id="activities-form">
+{% csrf_token %}
+
+{% if form.non_field_errors %}
+<div class="ym-fbox-text ym-error">
+ {% for error in form_activities.non_field_errors %}
+ <p class="ym-message">{% trans error %}</p>
+ {% endfor %}
+</div>
+{% endif %}
+
+<table>
+ {% for current_field in form_activities %}
+ {% if current_field.name in select_lists_activities %}
+ {% yaml_form_field current_field "ym-fbox-select" %}
+ {% else %}
+ {% yaml_form_field current_field %}
+ {% endif %}
+ {% endfor %}
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="{% trans 'Calculate' %}" id="form-save">
+ </td>
+ </tr>
+</table>
+</form>
+
+<div id="activities-result-container" style="display:hidden;">
+ <p>{% trans 'You basic metabolic rate is: ' %} <span id="activities-result-value">-/-</span></p>
+</div>
+
+<h2>{% trans "Daily calories" %}</h2>
+<form action="{% url 'calories-calculate-activities' %}"
+ method="post"
+ class="ym-form"
+ id="total-calories-form">
+<table>
+ {% yaml_form_field form_calories.calories %}
+ <tr>
+ <td colspan="2">
+ <input type="submit" value="{% trans 'Calculate' %}" id="form-save">
+ </td>
+ </tr>
+</table>
+</form>
+
+
+
+{% endblock %}
+
+
+<!--
+ Side bar
+-->
+{% block sidebar %}{% if sidebar %}{% include sidebar %}{% endif %}{% endblock %}
diff --git a/wger/nutrition/urls.py b/wger/nutrition/urls.py
index efeefbaa6..58bf6d807 100644
--- a/wger/nutrition/urls.py
+++ b/wger/nutrition/urls.py
@@ -94,7 +94,7 @@ urlpatterns = patterns('wger.nutrition.views',
url(r'^ingredient/unit/(?P<pk>\d+)/edit/$',
permission_required('nutrition.change_ingredientweightunit')(unit.WeightUnitUpdateView.as_view()),
name='weight-unit-edit'),
-
+
# Ingredient to weight units cross table
url(r'^ingredient/unit-to-ingredient/add/(?P<ingredient_pk>\d+)/$',
@@ -106,4 +106,24 @@ urlpatterns = patterns('wger.nutrition.views',
url(r'^ingredient/unit-to-ingredient/(?P<pk>\d+)/delete/$',
permission_required('nutrition.add_ingredientweightunit')(unit_ingredient.WeightUnitIngredientDeleteView.as_view()),
name='weight-unit-ingredient-delete'),
+
+ # BMI
+ url(r'^bmi/$',
+ 'bmi.view',
+ name='bmi-view'),
+ url(r'^bmi/calculate$', # JS
+ 'bmi.calculate',
+ name='bmi-calculate'),
+
+ # Calories calculator
+ url(r'^calories-calculator/$',
+ 'calculator.view',
+ name='calories-calculator'),
+ url(r'^calories-calculator/calculate/bmi$',
+ 'calculator.calculate',
+ name='calories-calculate'),
+ url(r'^calories-calculator/calculate/activities$',
+ 'calculator.calculate_activities',
+ name='calories-calculate-activities'),
+
)
diff --git a/wger/nutrition/views/bmi.py b/wger/nutrition/views/bmi.py
new file mode 100644
index 000000000..e40c9a796
--- /dev/null
+++ b/wger/nutrition/views/bmi.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+
+# This file is part of wger Workout Manager.
+#
+# wger Workout Manager is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# wger Workout Manager is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+import json
+
+from django.template import RequestContext
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+
+from django.utils.translation import ugettext as _
+
+from wger.nutrition.forms import BmiForm
+
+
+logger = logging.getLogger('wger.custom')
+
+'''
+BMI views
+'''
+
+
+def view(request):
+ '''
+ The BMI calculator detail page
+ '''
+
+ context = {}
+ context['form'] = BmiForm()
+ return render_to_response('bmi/form.html',
+ context,
+ context_instance=RequestContext(request))
+
+
+def calculate(request):
+ '''
+ Calculates the BMI
+ '''
+
+ data = []
+
+ form = BmiForm(request.POST)
+ if form.is_valid():
+ height = form.cleaned_data['height'] / float(100)
+ result = {'bmi': '{0:.2f}'.format(float(80) / (height * height))}
+ data = json.dumps(result)
+ else:
+ logger.debug(form.errors)
+
+ # Return the results to the server
+ mimetype = 'application/json'
+ return HttpResponse(data, mimetype)
diff --git a/wger/nutrition/views/calculator.py b/wger/nutrition/views/calculator.py
new file mode 100644
index 000000000..dcd68798f
--- /dev/null
+++ b/wger/nutrition/views/calculator.py
@@ -0,0 +1,139 @@
+# -*- coding: utf-8 -*-
+
+# This file is part of wger Workout Manager.
+#
+# wger Workout Manager is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# wger Workout Manager is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+import json
+
+from django.template import RequestContext
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+
+from django.utils.translation import ugettext as _
+
+from wger.nutrition.forms import BmrForm
+from wger.nutrition.forms import PhysicalActivitiesForm
+from wger.nutrition.forms import DailyCaloriesForm
+from wger.manager.models import UserProfile
+
+
+logger = logging.getLogger('wger.custom')
+
+'''
+Protein calculator views
+'''
+
+
+def view(request):
+ '''
+ The basal metabolic rate detail page
+ '''
+
+ context = {}
+ context['form'] = BmrForm()
+ context['select_lists'] = 'gender'
+ context['form_activities'] = PhysicalActivitiesForm()
+ context['select_lists_activities'] = ('work_intensity',
+ 'sport_intensity',
+ 'freetime_intensity')
+ context['form_calories'] = DailyCaloriesForm()
+
+ return render_to_response('rate/form.html',
+ context,
+ context_instance=RequestContext(request))
+
+
+def calculate(request):
+ '''
+ Calculates the basal metabolic rate.
+
+ Currently only the Mifflin-St.Jeor-Formel is supported
+ '''
+
+ data = []
+
+ form = BmrForm(request.POST)
+ if form.is_valid():
+ if form.cleaned_data['gender'] == UserProfile.GENDER_MALE:
+ factor = 5
+ else:
+ factor = -161
+ rate = ((10 * form.cleaned_data['weight']) # in kg
+ + (6.25 * form.cleaned_data['height']) # in cm
+ - (5 * form.cleaned_data['age']) # in years
+ + factor
+ )
+ result = {'bmr': '{0:.0f}'.format(rate)}
+ data = json.dumps(result)
+ #logger.debug(data)
+ #else:
+ # logger.debug(form.errors)
+
+ # Return the results to the server
+ mimetype = 'application/json'
+ return HttpResponse(data, mimetype)
+
+
+def calculate_activities(request):
+ '''
+ Calculates the calories needed by additional physical activities
+ '''
+
+ data = []
+
+ form = PhysicalActivitiesForm(request.POST)
+ if form.is_valid():
+
+ # Sleep
+ sleep = form.cleaned_data['sleep_hours'] * 1.9
+
+ # Work
+ if form.cleaned_data['work_hours'] == UserProfile.INTENSITY_LOW:
+ work_factor = 1.5
+ elif form.cleaned_data['work_hours'] == UserProfile.INTENSITY_MEDIUM:
+ work_factor = 2
+ else:
+ work_factor = 4
+ work = form.cleaned_data['work_hours'] * work_factor
+
+ # Sport
+ if form.cleaned_data['sport_hours'] == UserProfile.INTENSITY_LOW:
+ sport_factor = 3
+ elif form.cleaned_data['sport_hours'] == UserProfile.INTENSITY_MEDIUM:
+ sport_factor = 7
+ else:
+ sport_factor = 12
+ sport = form.cleaned_data['sport_hours'] * sport_factor
+
+ # Free time
+ if form.cleaned_data['freetime_hours'] == UserProfile.INTENSITY_LOW:
+ freetime_factor = 2
+ elif form.cleaned_data['freetime_hours'] == UserProfile.INTENSITY_MEDIUM:
+ freetime_factor = 4
+ else:
+ freetime_factor = 6
+ freetime = form.cleaned_data['freetime_hours'] * freetime_factor
+
+ total = (sleep + work + sport + freetime) / 24.0
+ result = {'activities': '{0:.2f}'.format(total)}
+ data = json.dumps(result)
+ logger.debug(data)
+ else:
+ logger.debug(form.errors)
+
+ # Return the results to the server
+ mimetype = 'application/json'
+ return HttpResponse(data, mimetype)
diff --git a/wger/software/templates/changelog.html b/wger/software/templates/changelog.html
index 5abd1005d..01d0ec981 100644
--- a/wger/software/templates/changelog.html
+++ b/wger/software/templates/changelog.html
@@ -12,6 +12,8 @@
<ul>
<li>New translation: Bulgarian (many thanks to Lyuboslav Petrov!)</li>
+ <li>BMI calculator</li>
+ <li>Daily calories calculator</li>
<li>New management utility for languages</li>
<li>Improved performance</li>
</ul>