aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2018-03-15Merge pull request #379 from ↵Alban Peignier
af83/6095-route--calculate-distance-and-time-cost-between-stops Calculate distance and time cost between Route stops. Refs #6095
2018-03-15Route: Don't run `#calculate_costs!` on callback if TomTom disabledTeddy Wing
We say `TomTom` is disabled when no API key is present. If this is the case, the `after_save` callback that uses it shouldn't be executed. I had to change my `API_KEY` constant to an instance variable to be able to change it for testing. Refs #6095
2018-03-15Delete number attributes for 3-Generic-2 compliance_controlLuc Donnet
2018-03-15Merge pull request #364 from af83/6028-compliance-controls-model-attributesLuc Donnet
Refs #6028 small changes in model attribute for CC
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-12Merge pull request #361 from af83/6068-simple-exporterLuc Donnet
6068 simple exporter
2018-03-12Refs #6133; First Crud for exportsZog
2018-03-09Create ci:build, ci:docker and ci:docker:clean. Rename ↵Alban Peignier
config/database/jenkins.yml in ci.yml. Refs #6047
2018-03-08Refs #6028 small changes in model attribute for CC6028-compliance-controls-model-attributescedricnjanga
2018-03-06Refs #6068; Add aggregated output for multiple interfacesZog
2018-03-06Fixes logs_output_dir in imports tasks and into ↵Alban Peignier
SimpleImporter#dump_csv_from_context. Refs #5924
2018-03-05Merge pull request #359 from af83/6068-simple-exporterAlban Peignier
Simple exporter. Refs #6068
2018-03-05Create output_dir if needed. Refs #6068Alban Peignier
2018-03-05Use Workbench#calendars in STIF::Dashboard. Refs #6064Alban Peignier
2018-03-05Refs #6068; Fully functional JSON exporterZog
2018-03-05Refs #6068; Add some helpers in the modelsZog
2018-03-05Refs #6068; Export VehicleJourneysZog
Add a mechanism to allow for several rows in the csv per single object in the collection.
2018-03-02Refs #6068; Refactor import/export tasksZog
2018-03-01Refs #6064; Use same logic to load calendars in dashboard and in controller6064-inconsistency-in-dashboardZog
2018-02-27Merge pull request #339 from af83/5878-fix-ComplianceChecksController-showLuc Donnet
5878 Add ComplianceCheck#show
2018-02-27refs #5878; Remove hard link between a ComplianceCheck and the associated ↵Zog
ComplianceControl
2018-02-27Refs #6026; Fix duplicated seeds tasks6026-dedicated-env-for-seedsZog
2018-02-26Refs #6026; Use SEED_ENV in seedbank, fallback on Rails.envZog
2018-02-21Move importers outputs in logsZog
2018-02-20Regs #5924; Rename imports tasksZog
2018-02-20Refs #5924; Fix some bugs revealed during importsZog
- The checksum computing for VehicleJourneyAtStops - Offsets calculation in VehicleJourneys
2018-02-20Refs #5924 @14h; Extend importersZog
Mostly add a way to override the default behaviour and process each row its own way
2018-02-20Refs #5924 @2h; Update specsZog
2018-02-20Refs #5924; Update rake tasksZog
2018-02-20Refs #5765; Add new task to import in a given referentialZog
2018-02-20Refs #5765 @6h; Add a customizable importer mechanismZog
2018-02-19Merge branch 'master' into 0000-dockerLuc Donnet
2018-02-16compile et embarque les traductions pour le javascriptdockerFlorent Peyraud
2018-02-13Merge pull request #287 from af83/4963-import-cron-should-abort-old-importsJohan Van Ryseghem
4963 import cron should abort old imports