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

default sort by closest to user #466

Open
3 tasks
jacobvenable opened this issue Apr 20, 2021 · 2 comments · May be fixed by #485
Open
3 tasks

default sort by closest to user #466

jacobvenable opened this issue Apr 20, 2021 · 2 comments · May be fixed by #485
Labels
Project: Server Related to the server workspace sorting and filtering ✅ Status: Dev Ready This is waiting to be started
Projects

Comments

@jacobvenable
Copy link
Member

jacobvenable commented Apr 20, 2021

related to #465

Description

When retrieving resources by category or subcategory, the client app sorts the results by what is open.

const resources = sortByOpen(

We should add another sorting step that sorts the resources to display those closest to the user first. This could either be done client-side (with another sorting function) or we could update the api to do both of these sorting options server side.

If we want to move this logic to the server, we will need to make a new endpoint (something like /api/v2/resources) where the client can send in a bunch of query params and get the specific results they are looking for.

interface ResourcesV2Params {
  category?: string;
  subcategory?: string;
  coordinates?: string;
  /** we may not need this yet but if we ever expand outside of Boulder this could be nice */
  localtime?: string;
  /** optional - but one day soon we may need to paginate these results */
  page?: number;
}

Checklist

  • Decide if this logic should live client-side or server-side.
  • when retrieving resources by a category and sub-category, and the user provides their coordinates (OR we apply the sorting client-side and leave the API as it is), the list of resources provided is sorted in the following order by default:
  1. resources that are open sorted by those closest to the user
  2. resources that are closed sorted by those closest to the user
  • when retrieving resources by a category and sub-category, and the user does not provide their coordinates, the list of resources is not sorted by proximity to the user (OR we just leave the API as it is)

Tech Notes

@jacobvenable jacobvenable added ⏸ Status: On Hold Addressing this issue later Project: Server Related to the server workspace sorting and filtering labels Apr 20, 2021
@jacobvenable jacobvenable added this to Backlog in All Issues via automation Apr 20, 2021
@jacobvenable jacobvenable changed the title default sort by closest to me default sort by closest to user Apr 20, 2021
@jollyjerr jollyjerr added ✅ Status: Dev Ready This is waiting to be started and removed ⏸ Status: On Hold Addressing this issue later labels Jun 12, 2021
@amites
Copy link
Contributor

amites commented Jun 26, 2021

started looking into this

@amites
Copy link
Contributor

amites commented Jul 30, 2021

it's a rabbit hole to sort this server side with mongo

nosql is not known for it's ability to handle joins well

I'm stashing an attempt that gets close but still takes a lot of massaging but feels like a dead end

going to add a client side sort by distance util and apply it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project: Server Related to the server workspace sorting and filtering ✅ Status: Dev Ready This is waiting to be started
Projects
All Issues
  
Backlog
Development

Successfully merging a pull request may close this issue.

3 participants