Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantization error in BMI calculator #91

Closed
rolandgeider opened this issue Sep 7, 2014 · 0 comments
Closed

Quantization error in BMI calculator #91

rolandgeider opened this issue Sep 7, 2014 · 0 comments
Milestone

Comments

@rolandgeider
Copy link
Member

Traceback (most recent call last):

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/home/rge/www/wger-patched/wger/nutrition/views/bmi.py", line 59, in calculate
    request.user.userprofile.user_bodyweight(form.cleaned_data['weight'])

  File "/home/rge/www/wger-patched/wger/core/models.py", line 384, in user_bodyweight
    entry.save()

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save
    force_update=force_update, update_fields=update_fields)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/base.py", line 573, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/base.py", line 635, in _save_table
    forced_update)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/base.py", line 679, in _do_update
    return filtered._update(values) > 0

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/query.py", line 510, in _update
    return query.get_compiler(self.db).execute_sql(None)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 980, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 776, in execute_sql
    sql, params = self.as_sql()

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 945, in as_sql
    val = field.get_db_prep_save(val, connection=self.connection)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 972, in get_db_prep_save
    self.max_digits, self.decimal_places)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/backends/__init__.py", line 1114, in value_to_db_decimal
    return util.format_number(value, max_digits, decimal_places)

  File "/home/rge/www/python-django/lib/python2.7/site-packages/django/db/backends/util.py", line 177, in format_number
    return "{0:f}".format(value.quantize(decimal.Decimal(".1") ** decimal_places, context=context))

  File "/package/host/localhost/python-2.7/lib/python2.7/decimal.py", line 2464, in quantize
    'quantize result has too many digits for current context')

  File "/package/host/localhost/python-2.7/lib/python2.7/decimal.py", line 3866, in _raise_error
    raise error(explanation)

InvalidOperation: quantize result has too many digits for current context
@rolandgeider rolandgeider added this to the 1.5 milestone Nov 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant