Transit-Talk icon indicating copy to clipboard operation
Transit-Talk copied to clipboard

add fix for duplicate stops

Open jonglass82 opened this issue 6 years ago • 3 comments

Closes #19 Fix Duplicate Stops

In our Lines#show view 'show.html.erb', I have updated line 13 where we call @line.stops to @line.stops.uniq. My thought is if all we are doing with this query is rendering stops from a specific line, the .uniq will take care of eliminating any duplicate stops rendered to the user.

We can also keep our current @line query in place in our #show method in the Lines Controller.

Manual testing was done by Identifying Lines in my local database that rendered duplicate stops, then implemented the change, then revisited the show view for those lines and saw the duplicates were removed.

Checklist:

  • [x] Code follows code style of this project
  • [ ] Tests added to cover changes
  • [ ] All new and existing tests passing

jonglass82 avatar Jan 23 '20 18:01 jonglass82

I'm not terribly familiar with this issue, so first and foremost, which line did you test this on? Secondly, this makes sense to fix up this view but we may need to do some further investigation on getting rid of the problem at the database level. I can think that at least the issues _form partial will have a list of stops which likely also has that duplication issue

ajblaida avatar Jan 24 '20 02:01 ajblaida

The data in my local database came from the suggested transit operator to use for testing in the readme:

rake transit:set_up_transitland TLAND_AGENCY_ONESTOP_ID=o-drke-9towntransit

The line I tested was the 'Maggio Inlet' line. The duplicate stop on that line was 'Hettinger Glen'. When I added the .uniq method to @line.stops in the Lines#show view, the duplication of 'Hettinger Glen' was fixed.

I agree with further investigation and I would like to take a closer look at this issue at the database level and understand why the duplication is occurring when the initial data is populated. Then maybe I can demonstrate and discuss further on Tuesday.

jonglass82 avatar Jan 24 '20 16:01 jonglass82

@jonglass82 This is a fine solution, but I'd love to talk with you and the others about a new model that will fix this issue and others. Hope you can make it on Tuesday!

tkimia avatar Jan 25 '20 19:01 tkimia