prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  BMI And Calorie Calculator Not Working
  Using this software in Linux Mint 13.
  When I enter my data into either the BMI calculator or the calorie estimator nothing happens.
  I have entered my height in cm and my weight in kgs.
  The BMI calculator says my BMI = 0.
  I'd be happy with 10.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `wger/nutrition/forms.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 # This file is part of wger Workout Manager.
  4 #
  5 # wger Workout Manager is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU Affero General Public License as published by
  7 # the Free Software Foundation, either version 3 of the License, or
  8 # (at your option) any later version.
  9 #
  10 # wger Workout Manager is distributed in the hope that it will be useful,
  11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 # GNU General Public License for more details.
  14 #
  15 # You should have received a copy of the GNU Affero General Public License
  16 
  17 import logging
  18 
  19 from django import forms
  20 from django.utils.translation import ugettext as _
  21 from wger.core.models import UserProfile
  22 
  23 from wger.nutrition.models import IngredientWeightUnit, Ingredient, MealItem
  24 from wger.utils.widgets import Html5NumberInput
  25 
  26 
  27 logger = logging.getLogger(__name__)
  28 
  29 
  30 class UnitChooserForm(forms.Form):
  31     '''
  32     A small form to select an amount and a unit for an ingredient
  33     '''
  34     amount = forms.DecimalField(decimal_places=2,
  35                                 max_digits=5,
  36                                 localize=True)
  37     unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),
  38                                   empty_label="g",
  39                                   required=False)
  40 
  41     def __init__(self, *args, **kwargs):
  42         super(UnitChooserForm, self).__init__(*args, **kwargs)
  43 
  44         if len(args) and args[0].get('ingredient'):
  45             ingredient_id = args[0]['ingredient']
  46 
  47         elif kwargs.get('data'):
  48             ingredient_id = kwargs['data']['ingredient_id']
  49 
  50         else:
  51             ingredient_id = -1
  52 
  53         self.fields['unit'].queryset = IngredientWeightUnit.objects.filter(
  54             ingredient_id=ingredient_id).select_related()
  55 
  56 
  57 class BmiForm(forms.ModelForm):
  58     weight = forms.DecimalField(widget=Html5NumberInput(),
  59                                 max_value=999)
  60 
  61     class Meta:
  62         model = UserProfile
  63         fields = ('height', )
  64 
  65 
  66 class BmrForm(forms.ModelForm):
  67     '''
  68     Form for the basal metabolic rate
  69     '''
  70     weight = forms.DecimalField(widget=Html5NumberInput())
  71 
  72     class Meta:
  73         model = UserProfile
  74         fields = ('age', 'height', 'gender')
  75 
  76 
  77 class PhysicalActivitiesForm(forms.ModelForm):
  78     '''
  79     Form for the additional physical activities
  80     '''
  81     class Meta:
  82         model = UserProfile
  83         fields = ('sleep_hours',
  84                   'work_hours',
  85                   'work_intensity',
  86                   'sport_hours',
  87                   'sport_intensity',
  88                   'freetime_hours',
  89                   'freetime_intensity')
  90 
  91 
  92 class DailyCaloriesForm(forms.ModelForm):
  93     '''
  94     Form for the total daily calories needed
  95     '''
  96 
  97     base_calories = forms.IntegerField(label=_('Basic caloric intake'),
  98                                        help_text=_('Your basic caloric intake as calculated for '
  99                                                    'your data'),
  100                                        required=False,
  101                                        widget=Html5NumberInput())
  102     additional_calories = forms.IntegerField(label=_('Additional calories'),
  103                                              help_text=_('Additional calories to add to the base '
  104                                                          'rate (to substract, enter a negative '
  105                                                          'number)'),
  106                                              initial=0,
  107                                              required=False,
  108                                              widget=Html5NumberInput())
  109 
  110     class Meta:
  111         model = UserProfile
  112         fields = ('calories',)
  113 
  114 
  115 class MealItemForm(forms.ModelForm):
  116     weight_unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),
  117                                          empty_label="g",
  118                                          required=False)
  119     ingredient = forms.ModelChoiceField(queryset=Ingredient.objects.all(),
  120                                         widget=forms.HiddenInput)
  121 
  122     class Meta:
  123         model = MealItem
  124         fields = '__all__'
  125 
  126     def __init__(self, *args, **kwargs):
  127         super(MealItemForm, self).__init__(*args, **kwargs)
  128 
  129         # Get the ingredient_id
  130         ingredient_id = None
  131 
  132         if kwargs.get('instance'):
  133             ingredient_id = kwargs['instance'].ingredient_id
  134 
  135         if kwargs.get('data'):
  136             ingredient_id = kwargs['data']['ingredient']
  137 
  138         # Filter the available ingredients
  139         if ingredient_id:
  140             self.fields['weight_unit'].queryset = \
  141                 IngredientWeightUnit.objects.filter(ingredient_id=ingredient_id)
  142
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py
  --- a/wger/nutrition/forms.py
  +++ b/wger/nutrition/forms.py
  @@ -55,6 +55,9 @@
   
   
   class BmiForm(forms.ModelForm):
  +    height = forms.DecimalField(widget=Html5NumberInput(),
  +                                max_value=999,
  +                                label=_('Height (cm)'))
       weight = forms.DecimalField(widget=Html5NumberInput(),
                                   max_value=999)
  
verification_info: {"golden_diff": "diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py\n--- a/wger/nutrition/forms.py\n+++ b/wger/nutrition/forms.py\n@@ -55,6 +55,9 @@\n \n \n class BmiForm(forms.ModelForm):\n+    height = forms.DecimalField(widget=Html5NumberInput(),\n+                                max_value=999,\n+                                label=_('Height (cm)'))\n     weight = forms.DecimalField(widget=Html5NumberInput(),\n                                 max_value=999)\n", "issue": "BMI And Calorie Calculator Not Working\nUsing this software in Linux Mint 13.\nWhen I enter my data into either the BMI calculator or the calorie estimator nothing happens.\nI have entered my height in cm and my weight in kgs.\nThe BMI calculator says my BMI = 0.\nI'd be happy with 10.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# wger Workout Manager is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n\nimport logging\n\nfrom django import forms\nfrom django.utils.translation import ugettext as _\nfrom wger.core.models import UserProfile\n\nfrom wger.nutrition.models import IngredientWeightUnit, Ingredient, MealItem\nfrom wger.utils.widgets import Html5NumberInput\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass UnitChooserForm(forms.Form):\n    '''\n    A small form to select an amount and a unit for an ingredient\n    '''\n    amount = forms.DecimalField(decimal_places=2,\n                                max_digits=5,\n                                localize=True)\n    unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),\n                                  empty_label=\"g\",\n                                  required=False)\n\n    def __init__(self, *args, **kwargs):\n        super(UnitChooserForm, self).__init__(*args, **kwargs)\n\n        if len(args) and args[0].get('ingredient'):\n            ingredient_id = args[0]['ingredient']\n\n        elif kwargs.get('data'):\n            ingredient_id = kwargs['data']['ingredient_id']\n\n        else:\n            ingredient_id = -1\n\n        self.fields['unit'].queryset = IngredientWeightUnit.objects.filter(\n            ingredient_id=ingredient_id).select_related()\n\n\nclass BmiForm(forms.ModelForm):\n    weight = forms.DecimalField(widget=Html5NumberInput(),\n                                max_value=999)\n\n    class Meta:\n        model = UserProfile\n        fields = ('height', )\n\n\nclass BmrForm(forms.ModelForm):\n    '''\n    Form for the basal metabolic rate\n    '''\n    weight = forms.DecimalField(widget=Html5NumberInput())\n\n    class Meta:\n        model = UserProfile\n        fields = ('age', 'height', 'gender')\n\n\nclass PhysicalActivitiesForm(forms.ModelForm):\n    '''\n    Form for the additional physical activities\n    '''\n    class Meta:\n        model = UserProfile\n        fields = ('sleep_hours',\n                  'work_hours',\n                  'work_intensity',\n                  'sport_hours',\n                  'sport_intensity',\n                  'freetime_hours',\n                  'freetime_intensity')\n\n\nclass DailyCaloriesForm(forms.ModelForm):\n    '''\n    Form for the total daily calories needed\n    '''\n\n    base_calories = forms.IntegerField(label=_('Basic caloric intake'),\n                                       help_text=_('Your basic caloric intake as calculated for '\n                                                   'your data'),\n                                       required=False,\n                                       widget=Html5NumberInput())\n    additional_calories = forms.IntegerField(label=_('Additional calories'),\n                                             help_text=_('Additional calories to add to the base '\n                                                         'rate (to substract, enter a negative '\n                                                         'number)'),\n                                             initial=0,\n                                             required=False,\n                                             widget=Html5NumberInput())\n\n    class Meta:\n        model = UserProfile\n        fields = ('calories',)\n\n\nclass MealItemForm(forms.ModelForm):\n    weight_unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),\n                                         empty_label=\"g\",\n                                         required=False)\n    ingredient = forms.ModelChoiceField(queryset=Ingredient.objects.all(),\n                                        widget=forms.HiddenInput)\n\n    class Meta:\n        model = MealItem\n        fields = '__all__'\n\n    def __init__(self, *args, **kwargs):\n        super(MealItemForm, self).__init__(*args, **kwargs)\n\n        # Get the ingredient_id\n        ingredient_id = None\n\n        if kwargs.get('instance'):\n            ingredient_id = kwargs['instance'].ingredient_id\n\n        if kwargs.get('data'):\n            ingredient_id = kwargs['data']['ingredient']\n\n        # Filter the available ingredients\n        if ingredient_id:\n            self.fields['weight_unit'].queryset = \\\n                IngredientWeightUnit.objects.filter(ingredient_id=ingredient_id)\n", "path": "wger/nutrition/forms.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# wger Workout Manager is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n\nimport logging\n\nfrom django import forms\nfrom django.utils.translation import ugettext as _\nfrom wger.core.models import UserProfile\n\nfrom wger.nutrition.models import IngredientWeightUnit, Ingredient, MealItem\nfrom wger.utils.widgets import Html5NumberInput\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass UnitChooserForm(forms.Form):\n    '''\n    A small form to select an amount and a unit for an ingredient\n    '''\n    amount = forms.DecimalField(decimal_places=2,\n                                max_digits=5,\n                                localize=True)\n    unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),\n                                  empty_label=\"g\",\n                                  required=False)\n\n    def __init__(self, *args, **kwargs):\n        super(UnitChooserForm, self).__init__(*args, **kwargs)\n\n        if len(args) and args[0].get('ingredient'):\n            ingredient_id = args[0]['ingredient']\n\n        elif kwargs.get('data'):\n            ingredient_id = kwargs['data']['ingredient_id']\n\n        else:\n            ingredient_id = -1\n\n        self.fields['unit'].queryset = IngredientWeightUnit.objects.filter(\n            ingredient_id=ingredient_id).select_related()\n\n\nclass BmiForm(forms.ModelForm):\n    height = forms.DecimalField(widget=Html5NumberInput(),\n                                max_value=999,\n                                label=_('Height (cm)'))\n    weight = forms.DecimalField(widget=Html5NumberInput(),\n                                max_value=999)\n\n    class Meta:\n        model = UserProfile\n        fields = ('height', )\n\n\nclass BmrForm(forms.ModelForm):\n    '''\n    Form for the basal metabolic rate\n    '''\n    weight = forms.DecimalField(widget=Html5NumberInput())\n\n    class Meta:\n        model = UserProfile\n        fields = ('age', 'height', 'gender')\n\n\nclass PhysicalActivitiesForm(forms.ModelForm):\n    '''\n    Form for the additional physical activities\n    '''\n    class Meta:\n        model = UserProfile\n        fields = ('sleep_hours',\n                  'work_hours',\n                  'work_intensity',\n                  'sport_hours',\n                  'sport_intensity',\n                  'freetime_hours',\n                  'freetime_intensity')\n\n\nclass DailyCaloriesForm(forms.ModelForm):\n    '''\n    Form for the total daily calories needed\n    '''\n\n    base_calories = forms.IntegerField(label=_('Basic caloric intake'),\n                                       help_text=_('Your basic caloric intake as calculated for '\n                                                   'your data'),\n                                       required=False,\n                                       widget=Html5NumberInput())\n    additional_calories = forms.IntegerField(label=_('Additional calories'),\n                                             help_text=_('Additional calories to add to the base '\n                                                         'rate (to substract, enter a negative '\n                                                         'number)'),\n                                             initial=0,\n                                             required=False,\n                                             widget=Html5NumberInput())\n\n    class Meta:\n        model = UserProfile\n        fields = ('calories',)\n\n\nclass MealItemForm(forms.ModelForm):\n    weight_unit = forms.ModelChoiceField(queryset=IngredientWeightUnit.objects.none(),\n                                         empty_label=\"g\",\n                                         required=False)\n    ingredient = forms.ModelChoiceField(queryset=Ingredient.objects.all(),\n                                        widget=forms.HiddenInput)\n\n    class Meta:\n        model = MealItem\n        fields = '__all__'\n\n    def __init__(self, *args, **kwargs):\n        super(MealItemForm, self).__init__(*args, **kwargs)\n\n        # Get the ingredient_id\n        ingredient_id = None\n\n        if kwargs.get('instance'):\n            ingredient_id = kwargs['instance'].ingredient_id\n\n        if kwargs.get('data'):\n            ingredient_id = kwargs['data']['ingredient']\n\n        # Filter the available ingredients\n        if ingredient_id:\n            self.fields['weight_unit'].queryset = \\\n                IngredientWeightUnit.objects.filter(ingredient_id=ingredient_id)\n", "path": "wger/nutrition/forms.py"}]}