aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2018-03-20Don't use Import::Base#status_changed? into #notify_parent (status can be ↵Alban Peignier
changed by java side). Refs #6243
2018-03-18Refs #6210 Remove status value attribue from Chouette::VehicleJourney and ↵6210-remove-attributes-from-modelscedricnjanga
section status fron Chouette::JourneyPattern
2018-03-16Fix reflex sync Refs #6141Luc Donnet
2018-03-16Fix stop_area state for filter and display. Update reflex sync to use ↵Luc Donnet
confirmed_at. Refs #6141
2018-03-15Avoid error when distance or time cost is ignored. Refs #6203Alban Peignier
2018-03-15RouteWayCostUnitConverter: Round kilometres to 2 decimal placesTeddy Wing
The JavaScript validation doesn't pass if we have more than two decimal places (I think because it uses a number field step value of 0.01). Round the values to allow them to pass frontend validation. Refs #6203
2018-03-15Rename `RouteWayCostJSONSerializer` to `RouteWayCostUnitConverter`Teddy Wing
Because we need to pass a Ruby hash to Rabl instead of a JSON string, get rid of our serialiser and instead turn it into a function that just converts the distance & time units. Fix a bug in the test that had the `'1-2'` key as a symbol instead of a string which was caused by a copy-paste from JSON and not being thorough enough in search-and-replace. Refs #6203
2018-03-15Add `RouteWayCostJSONSerializer`Teddy Wing
This serialiser will take `Route#costs` and convert the distance and time fields from meters to kilometres and seconds to minutes respectively. We need this because the frontend uses kilometre and minute units while the TomTom API gives us the others (and we store the data we get from TomTom without treatment). Unfortunately, due to the way that Rabl works, this doesn't quite work just yet. The serializer returns a string, and Rabl just puts this string into the JSON output instead of a real JSON hash. Looks like I'm going to have to convert my serializer into a generic converter. Refs #6203
2018-03-15JourneyPatternsCollection#show: Fallback to route costsTeddy Wing
When editing a `JourneyPattern`, you can edit the distance & time costs between stops. We want to pre-fill these cost values (in the input fields) if they haven't already been set by a user. This way, they get an existing estimate of the cost and don't have to enter a value manually unless the default doesn't work. The pre-filled values come from `Route#costs`, which get calculated ahead of time via the TomTom API. Add a new `fetchRouteCosts` function that will fetch the costs for the current route from the API. This function also caches the value on `actions` so we don't keep making requests since the data isn't going to change. Put the cached fetch in a `requestAnimationFrame` as a sort of timeout to prevent a warning from React complaining about doing this during a `render()` call. Update `getTimeAndDistanceBetweenStops` to use the cost value from the route costs instead of the journey pattern costs if it doesn't exist. The `totalDistance` and `totalTime` we moved into `componentWillUpdate` instead of `render()` because we thought that might be the cause of the `render()` warning I mentioned above. Decided to leave this part in even though it doesn't have anything to do with the goal of the changes here, because it seemed like an okay change. The `RECEIVE_ROUTE_COSTS` reducer will update the state with route costs. We need the default distance:0 time:0 to avoid infinitely fetching the costs API if a cost with the given key can't be found. Put the route cost API URL in `window.routeCostsUrl` to allow us to get it from the Rails URL helper. Huge thanks to Johan for pairing with me on this code and walking me through the setup for integrating the route costs JSON response into the frontend interface. Refs #6203
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-15Merge pull request #372 from af83/6146-line-statesLuc Donnet
6146 Line state update
2018-03-15Rename export spec to use the right classes Refs #6133 @1Luc Donnet
2018-03-15Fixes VehicleJourneys javascript spec. Refs #6143Alban Peignier
2018-03-15Fix javascript specsZog
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-15Merge pull request #377 from af83/6107-bind-stop_area_referential-and-workgroupsAlban Peignier
Refs 6106 & 6107. Binds LineReferentials and StopAreaReferentials to Workgroups
2018-03-15Use confirmed StopAreas in SimpleImporter spec. Refs #6033Alban Peignier
2018-03-15Merge pull request #376 from af83/6006-fix-stops-filterAlban Peignier
Fix VehicleJourney#with_ordered_stop_area_ids scope. Refs #6006
2018-03-15Merge pull request #375 from af83/6040-fix-stop-points-poitions-in-merged-routesAlban Peignier
Enforce stop points positions in merged Referential. Refs #6040
2018-03-15Refs #6033 Fix stop areas spec featurecedricnjanga
2018-03-15Refs #6033 add specscedricnjanga
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-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-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-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-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-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-14Merge pull request #348 from af83/6036-fix-journeys-editorAlban Peignier
Fix the journeys time editor. Refs #6036
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-14Refs #5972 @1h; Automatic registration_number generationZog
2018-03-14Refs #61066107-bind-stop_area_referential-and-workgroupsZog
Refs #6107 Binds LineReferentials and StopAreaReferentials to Workgroups, and enforce uniqueness
2018-03-14Refs #6146; Fix display in tablesZog
2018-03-14Refs #6146; Add specsZog
2018-03-13Try and fix specsZog
2018-03-13Refs #6006; Fix VehicleJourney#with_ordered_stop_area_ids scope6006-fix-stops-filterZog
2018-03-13Refs #6040; Enforce stop points positions in merged Referential6040-fix-stop-points-poitions-in-merged-routesZog
2018-03-12Fix specsZog
2018-03-12Merge pull request #361 from af83/6068-simple-exporterLuc Donnet
6068 simple exporter
2018-03-12Refs #5146 Line state updatecedricnjanga
2018-03-12Regs #6133; Define file's extensions whitelist on a per-class basis6133-new-exportsZog
2018-03-12Refs #6133; Fix specsZog
2018-03-12Refs #6135; ExportsController#upload endpointZog
With token-based authentication
2018-03-12Refs #6133; Full UX for exportsZog
Also added a *dumb* `WorkgroupExport` for testing purposes.
2018-03-12Refs #6133; Add options on the Exports, and forward them tu the UXZog