ComputerScienceHouse / game-night

A board and card games database for Computer Science House.
https://game-night.csh.rit.edu
3 stars 5 forks source link

Submitting games doesn't work #71

Open cecilialau6776 opened 3 weeks ago

cecilialau6776 commented 3 weeks ago

It returns an internal server error

Mstrodl commented 2 weeks ago
[2024-11-04 14:34:06,365] ERROR in app: Exception on /submit [POST]
Traceback (most recent call last):
  File "/opt/app-root/lib/python3.6/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/app-root/lib/python3.6/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/app-root/lib/python3.6/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/app-root/lib/python3.6/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/app-root/lib/python3.6/site-packages/flask_pyoidc/flask_pyoidc.py", line 228, in wrapper
    return view_func(*args, **kwargs)
  File "/opt/app-root/src/game_night/__init__.py", line 143, in submit
    if not game.validate():
  File "/opt/app-root/src/game_night/game.py", line 53, in validate
    if not FlaskForm.validate(self):
  File "/opt/app-root/lib/python3.6/site-packages/wtforms/form.py", line 329, in validate
    return super().validate(extra)
  File "/opt/app-root/lib/python3.6/site-packages/wtforms/form.py", line 146, in validate
    if not field.validate(self, extra):
  File "/opt/app-root/lib/python3.6/site-packages/wtforms/fields/core.py", line 242, in validate
    stop_validation = self._run_validation_chain(form, chain)
  File "/opt/app-root/lib/python3.6/site-packages/wtforms/fields/core.py", line 262, in _run_validation_chain
    validator(form, self)
  File "/opt/app-root/src/game_night/game.py", line 21, in _validate_name
    if game_exists(field.data):
  File "/opt/app-root/src/game_night/database.py", line 88, in game_exists
    return _games.count({'name': compile(f'^{escape(name)}$', I)})
  File "/opt/app-root/lib/python3.6/site-packages/pymongo/collection.py", line 3169, in __call__
    "failing because no such method exists." % self.__name.split(".")[-1]
TypeError: 'Collection' object is not callable. If you meant to call the 'count' method on a 'Collection' object it is failing because no such method exists.

Looks like an issue with mongodb version