mentorship-android icon indicating copy to clipboard operation
mentorship-android copied to clipboard

Search feature is not working

Open annabauza opened this issue 5 years ago • 6 comments

Describe the bug After merging all GCI search feature is not working as expected

To Reproduce Steps to reproduce the behavior:

  1. Go to members
  2. Click on search icon
  3. Type in username which exists
  4. See the list is empty
  5. Press cross to cancel search 6 See list is not reverted

Expected behavior Search shows existing users by username or name

Screenshots

Screenshot 2020-02-23 at 20 12 16 Screenshot 2020-02-23 at 20 12 29 Screenshot 2020-02-23 at 20 12 41

annabauza avatar Feb 23 '20 20:02 annabauza

Hey @annabauza @isabelcosta! Can I work on this issue?

sidvenu avatar Feb 28 '20 13:02 sidvenu

@sidvenu You can work on this issue. Before sending the PR can you tell what has gone wrong and why the search isn't working.

m-murad avatar Feb 28 '20 13:02 m-murad

I'm still working on this issue - it took me some time to set up the local server. Trying to find the issue now.

sidvenu avatar Mar 03 '20 16:03 sidvenu

Just a status update - I was caught up with quite a lot of work the past few days, I'll be done with the issue by this weekend.

sidvenu avatar Mar 06 '20 20:03 sidvenu

Cool @sidvenu ! thank you so much for the update :)

isabelcosta avatar Mar 06 '20 20:03 isabelcosta

MembersAdapter has a userList and a filteredUserList. The filteredUserList is what is shown to the user.

When a search term is entered, an object of MembersAdapter class is created. But, whenever MembersAdapter is created, the userList is set in the object, but filteredUserList is empty (filteredUserList = mutableListOf<User>()). So, only an empty list is used to show the members to the user, thus the search feature wouldn't work.

There are different approaches to solve this, and I've made the changes in such a way it doesn't affect other features of the app. I'll submit a PR for the same.

sidvenu avatar Mar 08 '20 10:03 sidvenu