Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display nearby books in Explore Nearby Screen #94

Closed
Mohitmadhav opened this issue Oct 2, 2021 · 9 comments · Fixed by #140
Closed

Display nearby books in Explore Nearby Screen #94

Mohitmadhav opened this issue Oct 2, 2021 · 9 comments · Fixed by #140
Assignees
Labels
enhancement new feature requests firebase For Firebase related issues good first issue good issue for first-time contributors Hacktoberfest For Hacktoberfest 2021 high-priority Something that has a high priority medium medium level issue

Comments

@Mohitmadhav
Copy link
Member

Mohitmadhav commented Oct 2, 2021

Description

  • Write code so that we can find all the users in a 5 km radius.
  • We should be able to do it by calculating distance via a lat long field of users.
  • We should then be able to fetch all books that belong to all the users within a 5 km radius.
  • Similarly, we need to do for 5-10 km, and 10-20 km (The dummy UI is shown below)

Screenshots

image

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Firebase files: lib/services/database_service.dart
  2. Explore Nearby Screen: lib/screens/explore_nearby.dart
  3. UserData is created whenever the User gets signed in. (See lib/services/auth.dart)
  4. So the book should contain all the book and owner info ( See Revamp Book and User Collections  #92 )
  5. Add the code in both the files using Firebase code and Firebase ML (if required)
  6. Do not remove the Empty Page Widget, just keep it for the case when no books are available.

Additional data

If there's something related to ML, then you can always discuss it with @ankitoscar here.
Share relevant app screenshots of your before committing any changes.

@Mohitmadhav Mohitmadhav added high-priority Something that has a high priority medium medium level issue Hacktoberfest For Hacktoberfest 2021 enhancement new feature requests firebase For Firebase related issues good first issue good issue for first-time contributors labels Oct 2, 2021
@kshitij5
Copy link
Contributor

kshitij5 commented Oct 7, 2021

Hi, I would like to try solve this issue!

@Mohitmadhav
Copy link
Member Author

Cool @kshitij5, and make sure to follow linting and the README guidelines.

@Mohitmadhav
Copy link
Member Author

@ankitoscar you can help out @kshitij5 if required.

@kshitij5
Copy link
Contributor

kshitij5 commented Oct 8, 2021

@Mohitmadhav yes, I might need help! As of now, what I am doing is fetching all the other user's details, calculating their distances from the current user, and displaying books listed by them as per the requirement! But, I think this will to too costly and not scalable also! So, is there any way to reduce the reads, or is it okay for now?

@Mohitmadhav
Copy link
Member Author

We just need the users within 10 km radius

@kshitij5
Copy link
Contributor

Hi, @Mohitmadhav. I tried implementing this feature but I just now figured out that redundant data is also getting added, every time the screen changes! I tried with Set but that doesn't seem to work. Is there any workaround?

@Mohitmadhav
Copy link
Member Author

What redundant data exactly?
@ankitoscar @HARSHBHUDOLIA can you also join?

@HARSHBHUDOLIA
Copy link
Collaborator

For now I also can think of only that way which you did, one way to improve the algorithm is to store which city the user is in addition to its location, this can be helpful as we then only have to calculate distance of those in same city, we can also customise it to add blocks/sector in cities.

@HARSHBHUDOLIA
Copy link
Collaborator

The Geolocation package/api gives a detailed address based on location, so if we can store all the different values like city/state/pin number/street in user in different fields then we can do a better search, we can start with Pin Number, which is generally associated with nearest post office to limit the calculations.

I hope what I am saying is understandable

Mohitmadhav added a commit that referenced this issue Oct 24, 2021
Fixes #94 : Display nearby books in Explore Nearby Screen Implemented
And removed play store navigations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new feature requests firebase For Firebase related issues good first issue good issue for first-time contributors Hacktoberfest For Hacktoberfest 2021 high-priority Something that has a high priority medium medium level issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants