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

Sort trips by closest to arrival time #41

Open
margaretgorguissian opened this issue Jan 11, 2017 · 2 comments
Open

Sort trips by closest to arrival time #41

margaretgorguissian opened this issue Jan 11, 2017 · 2 comments
Assignees

Comments

@margaretgorguissian
Copy link

On the trip page, entries are sorted by how close they are to the user's arrival time.

@GrahamGoudeau
Copy link
Owner

I determined that the effort required to implement this on the existing live site is too significant, considering that we're doing massive rewrites anyway. Instead, we should implement this here from the beginning.

There are a couple things this would involve:

  • lists of trips will come from the db.getTripsFromCampus() method and the db.getTripsFromAirport() method. These methods were written before the AddToCampusOrAirport enum was created (this enum is poorly named- it's used as an indication for what kind of trip is being worked on). The first step should be to combine these into a single method; possibly just use the getTrips() method, and add a tripType parameter in the style of searchTrips().
  • Rather than sort the results ourselves, let's let mongoose (the library that actually handles talking to Mongo) do it for us. Take a look at the accepted answer here http://stackoverflow.com/questions/5825520/in-mongoose-how-do-i-sort-by-date-node-js for some possibilities on how to do this.

@GrahamGoudeau
Copy link
Owner

Not all the code to manage retrieving trips is present yet, but I should get it in at some point tomorrow. Nothing I mentioned above should change though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants