paxswill / evesrp

EVE Ship Replacement Program (SRP) webapp
BSD 2-Clause "Simplified" License
18 stars 14 forks source link

Numeric field overflow when setting a payout #71

Closed adrien-f closed 10 years ago

adrien-f commented 10 years ago

So I got this weird bug reported by Sentry on updating a payout, any thoughts ?

DataError: (DataError) numeric field overflow DETAIL: A field with precision 15, scale 2 must round to an absolute value less than 10^13. 'UPDATE request SET payout=%(payout)s WHERE request.id = %(request_id)s' {'payout': Decimal('-44999950000000.00'), 'request_id': 41405417}

Stacktrace (appel le plus récent en dernier) : 

  File "flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "site-packages/flask_login.py", line 758, in decorated_view
    return func(*args, **kwargs)
  File "evesrp/views/requests.py", line 842, in modify_request
    return _add_modifier(srp_request)
  File "evesrp/views/requests.py", line 739, in _add_modifier
    db.session.commit()
  File "sqlalchemy/orm/scoping.py", line 150, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "sqlalchemy/orm/session.py", line 776, in commit
    self.transaction.commit()
  File "sqlalchemy/orm/session.py", line 377, in commit
    self._prepare_impl()
  File "sqlalchemy/orm/session.py", line 357, in _prepare_impl
    self.session.flush()
  File "sqlalchemy/orm/session.py", line 1919, in flush
    self._flush(objects)
  File "sqlalchemy/orm/session.py", line 2037, in _flush
    transaction.rollback(_capture_exception=True)
  File "sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "sqlalchemy/orm/session.py", line 2001, in _flush
    flush_context.execute()
  File "sqlalchemy/orm/unitofwork.py", line 372, in execute
    rec.execute(self)
  File "sqlalchemy/orm/unitofwork.py", line 526, in execute
    uow
  File "sqlalchemy/orm/persistence.py", line 60, in save_obj
    mapper, table, update)
  File "sqlalchemy/orm/persistence.py", line 518, in _emit_update_statements
    execute(statement, params)
  File "sqlalchemy/engine/base.py", line 729, in execute
    return meth(self, multiparams, params)
  File "sqlalchemy/sql/elements.py", line 321, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "sqlalchemy/engine/base.py", line 826, in _execute_clauseelement
    compiled_sql, distilled_params
  File "sqlalchemy/engine/base.py", line 958, in _execute_context
    context)
  File "sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
    exc_info
  File "sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "sqlalchemy/engine/base.py", line 951, in _execute_context
    context)
  File "sqlalchemy/engine/default.py", line 436, in do_execute
    cursor.execute(statement, parameters)
paxswill commented 10 years ago

Sorry for the delay in responding, this is the same issue as #69. I've fixed it locally (when recalculating the payout when a new bases is set, it considers all modifiers, not just those for that request. whoops) but I'm waiting to push it out until I've fixed a bug in the cache busting bit I added.

paxswill commented 10 years ago

Fixed in ac05059c8593fec5d2590b7ab0dd769c68595102