Closed RyotaMitaraiWeb closed 2 months ago
Looks and feels good, however, I found the following bug:
Also, I've been thinking - the "Review Order" button would look nicer if it's of variant outlined
, and color primary
.
Also, let's make it, so reviews can only be left after the order is completed or rejected. I'll fix it in the backend.
I was unable to reproduce the bug, unfortunately. If it's an issue on the front-end, my guess would be incorrect retrieval of the feedback for the given order, but I'd need to investigate further before I can conclude
The other comments have been implemented, I also updated tests again to reflect this
To be more specific about the bug, I tried creating multitudes of orders and reviews from three different accounts and everything works correctly on my side, even after refreshing on all ends
Update: I managed to reproduce the bug on my end, so I can confirm it exists, I will investigate more
so upon further investigation, I am 90% sure this is a bug on the backend, not on the frontend, since I managed to reproduce it even with the Swagger client + I think I know where the issue is coming from
How to actually reproduce the bug To reproduce the bug, do the following (assuming a clean database with no prior orders and feedbacks):
The issue seems to come from how the backend retrieves the feedbacks, more specifically on line 85 in order/views.py
. From what I read, zip
will pair the nth element of each collection together until the smallest one gets exhausted. Because our review, intended for order two, is the first one to be retrieved (as it's the only one in the database) and order one is the first order to be retrieved (because it was created first), they end up paired together, thus the backend tells me that this review's order ID is 1 (the correct ID would be 2).
Another way to confirm the existence of an issue with the retrieval is to compare what the backend tells you with what the DB tells you (via PGAdmin4). The database correctly maps our review to order two, but the backend will tell you that the review is intended for order one
@milensski @dinocom33 can you guys check this bug out?
Hi,
I was able to reproduce the bug even with 18 orders, when I made a review to order 14 it went in order 1, I will examine it and will fix.
@RyotaMitaraiWeb Thanks for looking into it , I will check your advise first.
This PR makes the feedback part of the orders modal functional.
For now, the frontend retrieves the feedback for each of the displayed orders in the table, which is mostly so that they can be loaded instantly when the modal is opened. Buyers can leave a review at any point of the order (which is at least what happens on the backend, since you can leave a review even in an ordered state). Whether the save button is disabled has also been updated to account for the possibility of leaving a review.
Tests have been updated and some new ones have been added to reflect the new features.
Let me know if there are any issues