mentorship-backend
mentorship-backend copied to clipboard
Filtering relations with invalid relation_state returns an empty list instead of error message
Describe the bug
When relation_state
is a number (invalid filter) the API returns an empty list instead of a dictionary with an error message.
To Reproduce
Pre-requisite: have a user registered
Steps to reproduce the behavior:
- Login the user
- Access
GET /mentorship_relations
and filter byrelation_state
, with the value 2 - See the empty list as the response and 400 HTTP error code.
Expected behavior
If the HTTP code is 400, for BAD REQUEST, I think the response should contain a message explaining that the relation_state
filter is not valid.
Screenshots
Screenshot with 400 BAD REQUEST
and an empty list being returned when relation_state
have value 2
.

Desktop (please complete the following information):
- OS: Mac OS
- Browser: Chrome
- Version 🤷♀
Additional context
🤷♀
Is this a bug? Does this make sense? Should it continue to be an empty list?! Asking for opinion @annabauza @BadduCoder
Yeah @isabelcosta , It would be better if an error is returned. We don't want it to be considered as "There are no requests currently". Because in that case too, list would be empty.
@isabelcosta I would like to work on this!
@isabelcosta It Shows internal server error while registering for a new user,and while executing again it show error 400 username already exists.
I think it is not able to send email.
@PratibhaShrivastav sure you can work on this :)
@srivastava9 you are correct. Sometimes we have this issue, and it is related to Gmail security settings, that can be wrongly set. This problem is explained in issue #233. I think I fixed the issue in the email we used to send emails, and once the server comes back up I think this will be solved. Thank you for reporting this bug @srivastava9 :)
@isabelcosta I tried returning a dictionary with error message stated but while debugging i found that due to us using mashal_list_with functionality from flask for returning json array of mentorship relations we cannot do much about it without replacing the logic for returning relations.
@isabelcosta I want to work on this issue.
@isabelcosta, I don't know if this can be considered as a bug. Because perhaps relation_id = 2 (Accepted) is considered not a request anymore? I tried to run this on the Android UI and it doesn't seem to be anything wrong. So, this is what I've done.
- user testtwo sent request to testone and got accepted, they are now in relationship
- as user testtwo, if I look at my Requests tab, I have options: Pending, Past and All (I'm pretty sure 'All' means both Pending and Past, so not including current). At the time I did the test, I have no pending or past request.

- But since I have 'currently' one mentorship relation, I can see it inside my 'Relation' tab (this shows 'Current Relation'.

ATM, we're only allowed to have one mentorship relation at a time, I think this is an expected behaviour? But even if we have more than one relation at a time, shouldn't it still best not to display accepted requests in the 'Requests' tab but in the 'Relation' tab?
This is just my thoughts.... 😉 . What do you all think?
But then I noticed this, for a user who has no current relation and tried to send requests to more than one person (to widen their chance perhaps... 😀 ), only the last request got recorded and the previous one didn't (in my test I sent 2 requests). I think we can consider this as a bug then, coz the expected behaviour is for the all requests to be shown in 'Pending' and 'All' list.


But then I noticed this, for a user who has no current relation and tried to send requests to more than one person (to widen their chance perhaps... 😀 ), only the last request got recorded and the previous one didn't (in my test I sent 2 requests). I think we can consider this as a bug then, coz the expected behaviour is for the all requests to be shown in 'Pending' and 'All' list. (...)
Can you clarify what happened? there are 2 requests in the pending state but only one is shown both in the Pending and All tabs? @mtreacy002
So right now, a user can only be in only mentorship relation at a time (in the ACCEPTED state). And if I am not mistaken from the backend API, all requests should be fetched including the Accepted one, but in the Android UI we may filter the current one, since its shown in a specific screen.
@mtreacy002 from the message above the one I quoted, what are yous suggestions?
@isabelcosta I would like to work on this!
I have solved this problem now. So I can send the PR right away!
@hongsungin92 this is not assigned to you yet, and I see I lost some messages from previous contributors who are interested, let me ask them first if they still wish to work on this.
@PratibhaShrivastav are you still interested in working on this issue? I forgot to assign this to you at the time. let me know if this is not the case and I can assign it to someone else.
@srivastava9 @SanujBansal are you still interested?
oh I see..! please check and let me know :)
@isabelcosta can I work on this issue?
@hongsungin92 are you still interested? Since I got no answers so far, I can totally assign this to you :)
@chahat99 let me check first with @hongsungin92
@isabelcosta yes! I am still interested in this issue:)