P2JN / doit

Doit es una aplicación web que permite la gestión y el seguimiento de objetivos personales y grupales de forma sencilla, humana y amigable.
http://doit-app.azurewebsites.net/
3 stars 0 forks source link

BUG: explore noneType #150

Closed JSnow11 closed 2 years ago

JSnow11 commented 2 years ago

descripcion

en algunas ocasiones el explore devuelve lo siguiente:

TypeError at /api/user/62f5348c763b03eebe46a246/goal-recommendations
object of type 'NoneType' has no len()

Se debe investigar y descubrir donde puede estar fallando

story relacionada

comportamiento esperado

evitar este tipo de errores y devolver una lista vacía

JSnow11 commented 2 years ago

Error detallado

Internal Server Error: /api/user/62fd301ee347e2d78ae1ced0/user-recommendations
Traceback (most recent call last):
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/django/views/generic/base.py", line 84, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/home/snow/US/notes/4/tfg/TFG/env/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/snow/US/notes/4/tfg/TFG/social/views.py", line 256, in get
    sort_by_affinity = sorted(users,
  File "/home/snow/US/notes/4/tfg/TFG/social/views.py", line 257, in <lambda>
    key=lambda user: get_users_affinity(logged_user_goals, user, max_followers, max_posts,
  File "/home/snow/US/notes/4/tfg/TFG/utils/recomendations.py", line 21, in get_users_affinity
    affinity += goal_affinity(logged_goal, goal, max_participants)
  File "/home/snow/US/notes/4/tfg/TFG/utils/recomendations.py", line 27, in goal_affinity
    SequenceMatcher(None, logged_goal.get("description"), goal.get("description")).ratio() * 0.4 + \
  File "/usr/lib/python3.10/difflib.py", line 619, in ratio
    matches = sum(triple[-1] for triple in self.get_matching_blocks())
  File "/usr/lib/python3.10/difflib.py", line 442, in get_matching_blocks
    la, lb = len(self.a), len(self.b)
TypeError: object of type 'NoneType' has no len()
[17/Aug/2022 18:24:27] "GET /api/user/62fd301ee347e2d78ae1ced0/user-recommendations HTTP/1.1" 500 22777