aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2018-04-04Delete unused spec because we add a parameter to the function duplicate Refs ↵Luc Donnet
#6226
2018-04-04Merge pull request #390 from af83/6226-create-opposite-routeLuc Donnet
6226 Add a button to automatically create opposite routes
2018-04-04Refs #6226; Add spec6226-create-opposite-routeZog
2018-04-04Refs 6226; Add a button to create opposite routesZog
2018-04-04Fix ExportsController specsZog
We no longer return a redirect, but a JSON message instead
2018-04-04Fix more specsZog
2018-04-04Fix specsZog
2018-04-04:fire: logsZog
2018-04-04Fix specsZog
2018-04-04Fix specsZog
2018-04-04Refs #6089; Adds `attachment` Custom FieldsZog
As well as an helper to render them in a partial
2018-04-04Merge pull request #413 from ↵Alban Peignier
af83/6222-route-way-costs--use-TomTom-matrix-API-instead-of-batch Route way costs use tom tom matrix api instead of batch. Refs #6222
2018-03-30Merge pull request #360 from af83/new-uniqueness-validation-for-ccblocksLuc Donnet
New uniqueness validation for ccblocks
2018-03-30Merge pull request #428 from af83/4658-remove-current_functional_scopeAlban Peignier
Remove `current_functional_scope`. Refs #4658
2018-03-30Fix spec/features/calendars_permissions_spec.rb to use correct Workgroup ↵Luc Donnet
Refs #6258 @1
2018-03-30Merge pull request #397 from af83/6258-calendar-workgroupLuc Donnet
Refs #6258 associate calendars with current organisation
2018-03-29Refs #6258 Add speac feature for calendars and fix ↵6258-calendar-workgroupcedricnjanga
begin_of_association_chain in controller
2018-03-29Refs #4658; Remove `current_functional_scope`Zog
2018-03-29Refs #6075 Replace after_commit callback to after_create for the ↵cedricnjanga
set_defaults method
2018-03-29Refs #6075 Change default attributes for stop areascedricnjanga
2018-03-29Refs #6075 Set defaults attributes for stop point depending on stop area kindcedricnjanga
2018-03-29Fix MinMax ValidationZog
2018-03-28Merge pull request #398 from af83/6259-calendar-mailerLuc Donnet
Refs #6259 Only send mails to users from same workgroup after create/…
2018-03-27TomTom::Matrix: Serialize `BigDecimal` as floatTeddy Wing
Rails serialises `BigDecimal`s as JSON strings to prevent loss of precision. The `latitude` and `longitude` columns in `StopArea` are stored as `BigDecimal`s. The trouble is that TomTom's API requires the latitude & longitude values to be JSON floats, not strings. Make a new JSON serialiser that converts the `BigDecimal` coordinates to float to allow the values to be correctly interpreted by the API. Refs #6222
2018-03-27RouteWayCostCalculator: Use `TomTom.matrix` instead of batchTeddy Wing
Calculate routes using the TomTom matrix API. Update the spec's HTTP request stub accordingly (note that the stub is still fake). Refs #6222
2018-03-27TomTom::Matrix#points_from_way_costs: Use array instead of setTeddy Wing
Using a set ended up not working out. I needed to be able to index into the list in `#extract_costs_to_way_costs!`, and sets aren't indexable. This is because they're supposed to be unordered, though modern Ruby implements `Set` with `Hash` under the hood, which is ordered in Ruby. I like the idea of having a data structure that automatically eliminates duplicates, but it wasn't meant to be, because for the extraction to `WayCost`s, I need an ordered list. Rather than create a new `OrderedSet` type, I just went the simple route and used an Array, eliminating the duplicates manually because I know when duplicates are supposed to occur due to the nature of the data set. Remove the `#eql?` and `#hash` methods from `TomTom::Matrix::Point`. Because we're not longer using `Set`, these methods don't need to be implemented. Refs #6222
2018-03-27TomTom::Matrix#extract_costs_to_way_costs!: Try to include stop IDsTeddy Wing
Change this code to get stop IDs based on the change in be3e1effcdea87909a181c7e9b12cf6867b1839d. It should use these IDs to construct new `WayCost`s with the combination of stop IDs from departure and arrival stops. This doesn't work currently because the method has code that tries to index the `points` collection, but it's a `Set`, and sets don't support indexing and aren't ordered, so this code errors. Need to change the `Set` to something else that will work here. Refs #6222
2018-03-27TomTom::Matrix#points_as_params: Use `TomTom::Matrix::Point`sTeddy Wing
Rewrite this method to accept `TomTom::Matrix::Point`s instead of plain `Geokit::LatLng` coordinates. Do this because this method needs to take the result of `#points_from_way_costs` as input, and that method now returns a `Set` of `Point`s. Refs #6222
2018-03-27TomTom::Matrix#points_from_way_costs: Include stop IDs with pointsTeddy Wing
We need to persist stop IDs in order to properly construct `WayCost` objects from the costs returned from the TomTom matrix API. In order to persist stop IDs, my idea here is to group together a point and its corresponding ID into a bucket. When we later `#extract_costs_to_way_costs!`, we'll be able to grab the correct ID for a given coordinate to create a `WayCost` from it. Here, we create a new `TomTom::Matrix::Point` class that encapsulates a coordinate and an ID, and build a `Set` of those. I needed an `#eql?` and `#hash` method on `Point` as described in the `Set` documentation (https://ruby-doc.org/stdlib-1.9.3/libdoc/set/rdoc/Set.html) in order to properly maintain a unique set. Refs #6222
2018-03-27Add `TomTom::Matrix`Teddy Wing
A new component to the `TomTom` module that asks TomTom's Matrix API endpoint (https://developer.tomtom.com/online-routing/online-routing-documentation/matrix-routing) to compute `WayCost`s. The matrix API will give us all costs between each pair of coordinates. This will enable us to provide costs for any combination of points in a journey pattern. Given a list of `WayCost`s, it will send all points from those costs to the matrix API and return a list of all non-zero `WayCost`s between all pairs of coordinates. `points_from_way_costs()` extracts unique coordinates from the `WayCost`s. `points_as_params()` builds a list of points in the format expected by the matrix API. The response from the matrix API is formatted as a two-dimensional array consisting of rows and columns that pair each "origin" point with each "destination" point. We loop through this matrix and construct new `WayCost` objects for each pair of coordinates. At the moment, I haven't figured out how I want to save `WayCost` IDs when creating the new pairs. Leaving that for later. Refs #6222
2018-03-27Refs #6201; Remove short_name from calendarsZog
2018-03-26Fix exports_controller_spec.rb when add referential_id to NetexExport creationLuc Donnet
2018-03-26Use utc time to make expectation with strftime (when timezone are not ↵Alban Peignier
standard). Refs #6047
2018-03-22Remove maps code. Refs #6296Alban Peignier
2018-03-21Only notify parent when Import is finished. Refs #6243Alban Peignier
2018-03-21Refs #6259 Only send mails to users from same workgroup after create/update ↵6259-calendar-mailercedricnjanga
of shared calendars
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