Gofven / flowback

Flowback 1st Iteration
GNU General Public License v3.0
2 stars 3 forks source link

DoesNotExist at /group/poll/28/comment/56/vote CommentVote matching query does not exist. #89

Closed Kattenelvis closed 1 day ago

Kattenelvis commented 4 days ago

Whenever I send "{vote: null}" as a way to replace a down/up vote with a neutral vote (regretting one's upvote). This lead to the error 500 seen above. Perhaps a feature request here aswell: ensure that one can reject one's up/down vote. I take it that {vote:false} is a downvote, and not an unvote. Otherwise my feature request is to be allowed to downvote.

Kattenelvis commented 4 days ago

Traceback (most recent call last): File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 42, in inner response = await get_response(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 253, in _get_response_async response = await wrapped_callback(

File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view return view_func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc ^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/flowback/comment/views.py", line 124, in post self.lazy_action.func(args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/flowback/poll/services/comment.py", line 68, in poll_comment_vote return comment_vote(fetched_by=fetched_by, ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/flowback/comment/services.py", line 106, in comment_vote return CommentVote.objects.get(created_by=user, comment=comment).delete() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emil/flowback_backend/venv/lib/python3.11/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist( ^

Gofven commented 3 days ago

It seems the vote you're trying to delete does not exist, but i've added an exception handler for it c: Perhaps you're using the wrong id's? If not then i can look deeper into this c:

Kattenelvis commented 1 day ago

yeah we can talk more about this at some point :> The problem here is that I want to be able to remove one's previous vote, downvote and upvote. I'm not sure you took three possible voting values into account.