aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-03-14Route: Run `#calculate_costs!` on `after_save`Teddy Wing
Not efficient to send a request to the TomTom API every time we save a Route, but I'm banking on developing a cache system soon to avoid having to make the requests, so hopefully that will stop this from making expensive remote calls all the time. Refs #6095
2018-03-14Route: Fix whitespaceTeddy Wing
This method wasn't indented to the same level as the rest of the file. Refs #6095
2018-03-14Route: Add `#calculate_costs!` to populate `#costs` with `WayCost`sTeddy Wing
This new method will launch a worker that takes the route's `StopArea`s, converts them to `WayCost`s, sends them to the TomTom API to calculate distance and time costs, and saves those costs to the route's `costs` field. Refs #6095
2018-03-14Route: Get rid of unnecessary whitespaceTeddy Wing
Refs #6095
2018-03-14Add `costs` column to `Chouette::Route`Teddy Wing
This allows us to store `WayCost`s for a route so we can use those values as pre-filled defaults for a `JourneyPattern`'s costs. Refs #6095
2018-03-14Add `WayCostCollectionJSONSerializer`Teddy Wing
A JSON serialiser for a collection of `WayCost`s. This will be used to store `WayCost`s for a `Chouette::Route` in the `Route#costs` JSON field. Refs #6095
2018-03-14Add `StopAreasToWayCostsConverter`Teddy Wing
A new class that converts a list of `StopArea`s to `WayCost`s. This will be called from `Chouette::Route` to get `WayCost`s from its stops, which will then be JSON serialised and stored in `Route#costs`. Update `WayCost`: * Remove comment about calculating the ID automatically. It actually needs to be the same as the `JourneyPattern#cost` ID (`key`), which is a string with the IDs of the departure and arrival stops. * Make `#==` check that `id`s are the same, which necessitates making `id` a reader. Refs #6095
2018-03-14TomTom::Batch: Extract code to `#extract_costs_to_way_costs!`Teddy Wing
Extract some code from `#batch` to allow us to test the part that takes distance and time values from the response JSON and put fill them into `WayCost`s. In order for the test to work, had to add an `#==` method to `WayCost` and make `distance` and `time` accessors. The JSON file fixture is a copy of a response from the TomTom `/batch` API. The file is pretty big. I'm not sure if maybe I should condense it for the sake of test performance. Refs #6095
2018-03-14TomTom::Batch: Rename `#convert_way_costs_for_batch`Teddy Wing
Rename to `#convert_way_costs` since this method now lives inside the `TomTom::Batch` class, so that part of the name became redundant. Refs #6095
2018-03-14TomTom: Provide `TomTom.batch(...)` methodTeddy Wing
This change enables us to call `TomTom.batch(...)` instead of `TomTom.new.batch(...)` a couple commits ago. This is nice because the initialisation was kind of unnecessary for users of the class. Refs #6095
2018-03-14tom_tom/batch: Use `module ...` syntaxTeddy Wing
Change the `TomTom::Batch` to `module ... class ...` syntax instead. I like this better in this case. Refs #6095
2018-03-14Move `lib/tom_tom.rb` to `lib/tom_tom/batch.rb`Teddy Wing
Separate the functionality a little better by moving the `/batch` endpoint code into a new class. The goal here is also to lay the foundation for being able to call `TomTom.batch()` instead of `TomTom.new.batch()`. Refs #6095
2018-03-14TomTom#batch: Populate WayCosts with distance & time from APITeddy Wing
Look through the API response from `/batch` and extract the distance & time values given to us by TomTom. These are inserted in the `WayCost`s given to use in the argument to `#batch`. At the end, we get a list of `WayCost`s that are completely filled with distance & time values. We need to split up this code a bit to make it more testable, but already this seems to function correctly. Refs #6095
2018-03-14secrets.yml: Add `tomtom_api_key`Teddy Wing
Make the TomTom API key accessible to the application. It gets set in Docker via an environment variable. Still need to work out how we're setting it in development. For now I'm just saving it in `secrets.yml` without committing it. Refs #6095
2018-03-14Revert "TomTom: Add method for `calculateRoute` endpoint"Teddy Wing
This reverts commit f28a4b2c5b348bc12b455aa0cd76a9513103aea7. As stated in that commit, I'm going to use the `/batch` endpoint instead of `/calculateRoute` because I know that's already working.
2018-03-14TomTom: Add method for `calculateRoute` endpointTeddy Wing
A new method to provide access to the `/calculateRoute` endpoint, which calculates costs for a single route through a bunch of waypoints. This doesn't work currently because the API requires that I send `supportingPoints` in the body of the request. Since I'm not too clear on what those are, I'm going to cut off development of this method here and just use `#batch` instead for my purposes. My idea was to use this endpoint instead of `/batch` to allow us to calculate a single route instead of having the API do `/calculateRoute` for each of our point pairs. This seemed like it would be more efficient, and give us our distance and time costs between each waypoint all in one go, but since I'm not clear on how to use this API and whether it will give us the correct data, I'm going to stick with `/batch`. I'll probably be reverting this code. Just committing it now in case it becomes useful in the future. Refs #6095
2018-03-14TomTom#batch: Remove unwanted paramsTeddy Wing
I had copy-pasted these from the example in the docs (https://developer.tomtom.com/online-routing/online-routing-documentation/batch-routing), but I don't think we want some of these. For `maxAlternatives`, it's already 0 by default according to their docs, and the others don't really make sense for us because we want a general routing instead of one based on traffic or time of day. Refs #6095
2018-03-14TomTom: Use travelMode='bus'Teddy Wing
For now, hard-code 'bus' as the travel mode. This feature is currently only going to be used for Ouibus, so we want to be able to request in 'bus' mode, but for now don't have time to think about how to make it more extensible to other travel modes and operators. Refs #6095
2018-03-14TomTom: Remove old commented codeTeddy Wing
These served during development but are no longer needed. Refs #6095
2018-03-14Add `TomTom` class to communicate with their APITeddy Wing
Provides an interface to communicate with the TomTom API. Currently includes a method `#batch` to make a batch routing request (https://developer.tomtom.com/online-routing/online-routing-documentation/batch-routing). Left a bunch of development-related code in just to preserve my in-progress stages. Originally I was told to use the matrix routing API, but that turned out to not match what we wanted. Namely, matrix routing would produce a table with every point routed with every other point. We instead want routes of each segment in a line, in order (or, just the diagonal of the matrix). Using the batch API allows us to get the routes we need without doing unnecessary work. Update the `WayCost` class to provide `departure` and `arrival` methods as readers, and make `id` an optional parameter for now. (We still need to figure out how we're dealing with ID.) Refs #6095
2018-03-14WayCost.new: Make `distance` and `time` arguments optionalTeddy Wing
We don't have these values until after the TomTom API calculation, but we need to create `WayCost` objects before then. Give these values defaults so we don't have to set them. Refs #6095
2018-03-14Create `WayCost`Teddy Wing
A data class to hold the distance and time cost required to go between departure and arrival points. Refs #6095
2018-03-14Merge pull request #348 from af83/6036-fix-journeys-editorAlban Peignier
Fix the journeys time editor. Refs #6036
2018-03-14Merge pull request #367 from af83/6042-detailed_purchase_windowsAlban Peignier
Add detailed view for purchase windows. Refs #6042
2018-03-14Merge pull request #342 from af83/6021-handlke-offsets-in-journeysAlban Peignier
Allow journeys to span over 3 days. Refs #6021
2018-03-14Refs #6012; Update STIF initializer6021-handlke-offsets-in-journeysZog
2018-03-14Refs #6021: Make DAY_OFFSET_MAX configurableZog
2018-03-14Refs #6021 @1h; Allow journeys to span over 3 daysZog
And fix the way offsets are computed to use the timezones
2018-03-14Merge pull request #341 from af83/5972-automatic-registration-numbersAlban Peignier
Automatic registration_number generation. Refs #5972
2018-03-14Replace hardcoded AAA by expression sized by registration_number_format. ↵Alban Peignier
Refs #5972
2018-03-14Refs #5972 @1h; Automatic registration_number generationZog
2018-03-14Small fixes/improvements in SimpleInterfacesZog
2018-03-14Update newrelic_rpm to 4.8.0.341. Refs #6206Alban Peignier
2018-03-14Merge pull request #378 from af83/6187-dashboard-calendar-link-fixLuc Donnet
Refs #6187 Fix Dashboard Calendar#show link
2018-03-14Delete @dashboard call to create link for calendar Refs #61876187-dashboard-calendar-link-fixLuc Donnet
2018-03-14Merge pull request #380 from ↵Luc Donnet
af83/6158-compliance-check-transport-submode-display Refs #6158 Fix display error when CC doesnt have transport submode
2018-03-13Refs #6158 Fix display error when CC doesnt have transport submode6158-compliance-check-transport-submode-displaycedricnjanga
2018-03-13Refs #6187 Fix Dashboard Calendar#show linkcedricnjanga
2018-03-13Try and fix specsZog
2018-03-13Fix bad name for vehicle_journey_control/delta in compliance_controls.fr.yml ↵Luc Donnet
Refs #6157 @1
2018-03-13Fix duplicate code in config/initializers/sidekiq.rbLuc Donnet
2018-03-13Merge pull request #371 from af83/5567-routes-map-on-line-showLuc Donnet
5567 Disable routes by default
2018-03-12Fix migration 20180306152953_update_imports_names with compact Refs #6133 @1Luc Donnet
2018-03-12Fix specsZog
2018-03-12Merge pull request #344 from af83/5896-add-cache-headersLuc Donnet
5896 Add cache-related headers for assets
2018-03-12Merge pull request #361 from af83/6068-simple-exporterLuc Donnet
6068 simple exporter
2018-03-12Merge pull request #362 from af83/6133-new-exportsLuc Donnet
6133 New exports
2018-03-12Refs #5567; Disable routes by default5567-routes-map-on-line-showZog
2018-03-12Regs #6133; Define file's extensions whitelist on a per-class basis6133-new-exportsZog
2018-03-12Refs #6133; Move heklper in the right placeZog