aboutsummaryrefslogtreecommitdiffstats
path: root/app/services
AgeCommit message (Collapse)Author
2018-05-31Refs #7031; Fix bug in consolidated viewZog
2018-05-28Refs #7031; Fix consolidated view7031-fox-consolidated-viewZog
And remove n+1 queries
2018-05-17Refs #7031; Page loading optimizationsZog
2018-05-16Merge pull request #553 from ↵Alban Peignier
af83/6884-tomtom-matrix--handle-error-when-response-doesn,t-inclu Handle API error(s) in Tomtom matrix. Fixes #6884
2018-05-07refs #6923; small improvementsZog
2018-05-04Refs #6923; Implement a consolidated viewZog
2018-05-04Move `TomTom::Matrix::RemoteError` to`TomTom::Errors::MatrixRemoteError`6884-tomtom-matrix--handle-error-when-response-doesn,t-incluTeddy Wing
I previously tried to correct a circular dependency problem in a057276129b1f62b811743db3b8f867a05241ed3, but that didn't fix it (it was intermittent, and came back). After some wrangling, I've now deduced with some confidence that the problem comes from `RouteWayCostCalculator`, which used `TomTom::Matrix::RemoteError`. From the way it looks, this seems to mess up the Rails autoloader since `tom_tom.rb` will try to load the `Matrix` class from the `TomTom.matrix` call above. Or something. In an attempt to fix the circular dependency error for real this time, move the error class to a completely separate module from `Matrix`, and refer to this when we need to use the error class. Refs #6884
2018-05-02RouteWayCostCalculator: Don't update `costs` if response errorsTeddy Wing
If there's an API error, we shouldn't update the route's `costs` field. Let's say we've already calculated some costs for a route A. We then edit and re-save A, which triggers a recalculation of the costs. Now the TomTom API responds with an error. We don't want to overwrite our existing costs with an empty array because they could still be useful. In this case, we should instead keep the existing costs we already had. To achieve this, move the `RemoteError` rescue into `RouteWayCostCalculator`, leaving the error unhandled in `TomTom.matrix`. Refs #6884
2018-04-09:fire: logZog
2018-04-09Refs #6360; Add checks on calendars during WorkbenchImportZog
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-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-01Small improvements on referential overviewsZog
2018-02-08imports.rake(notify_parent): Use `ParentNotifier`Teddy Wing
Replace `ParentImportNotifier` with the new generalised `ParentNotifier`. This will allow us to use the same service for parent notification of both imports and compliance check sets. Delete the `ParentImportNotifier` class and spec as these are now superseded by `ParentNotifier`. Refs #4758
2018-02-08Add `ParentNotifier` serviceTeddy Wing
This is a takeoff on `ParentImportNotifier`. I just copied over the class and spec and generalised the service to work with `Import`-style interfaces. We can now use the same notifier service class for both imports and compliance check sets. Refs #4758
2018-02-02Refs #3542 @1h; Adds filtersZog
2018-02-02Refs #3542 @1h; Add Time navigationZog
2018-02-02Refs #3542; Adds paginationZog
2018-02-02Refs #3542 @4h; First UIZog
Still missing: - Pagination - Filters
2017-12-15Refs: #5006@0.7h; CR changes from #5006 & staring error_messages in imports/showRobert
- Renaming as requested STIF::NetexFile::Frame.get_line_object_id -> get_sgort_id - working on error_messages for imports#show
2017-12-14Refs: #5281@2h; Code Analysis first bugfixRobert
- Rebased #5006 upoon master and created #5281 from #5006 - Setup regression test based on client provided input - Fixed bug with multiple spurious directory occurances
2017-12-14Refs #5006; CR pass IRobert
2017-12-14Refs: #5006@12h;Robert
Implementing allowed vs foreign line lookup for the zip service - Adapting `lib/stif/netex_file.rb` to expose the already implemented matching - `app/services/zip_service.rb` augmented to check for allowed lines and returning forbidden lines - Specs with fixtures and using the beforementioned new zip support in the specs - Fixture directories for the new specs
2017-12-04Hotfix API Controller < ActionController::Base0000-post_to_json_hotfix_for_local_appRobert
2017-12-01Hotfix for missing token in HTTPService when called from WorkbenchImportWorkerRobert
2017-10-24Refs: #4633@0.5h;Robert
Speced and implemented ZipService to return additional directories in the entry's `spurious` field.
2017-08-25Remove `RetryService`Teddy Wing
This is no longer being used as the `WorkbenchImportWorker` was refactored and it was decided that we don't want to enable retries for imports. For example, imagine you have an hour-long import that fails after 50 minutes. We retry three times and now we've wasted 2.5 hours of your time just to tell you that the import failed. Thus the decision was to remove it.
2017-08-22Refs: 4273@5h; Still debugging zip file upload inside post to Rails api; ↵Robert
Retry removed (but not the deadcode yet) [amend me]
2017-08-22Refs: #4273@3h;Robert
Debugging Java Integration (ZipService -> HTTPService -> Object Creation) - Created an ErrorFormat concern to see what went wrong in the HTTP call as so many things can go wrong due to: * Timeout Issues * Illegal database setup or cleaning before tests
2017-08-21Refs: #4273@20h; Reverse Engeneeiring RubyZip fixed ZipServiceRobert
- Replzed Lazy Enum over get_next_entry and group by with explicit looping and yielding to an instance level enumerator that yields streams per subdir (wich represents a referential). - Fixtures and Specs that use a REAL usecase. Next: Get rid of metadata kludge (should fix failing specs)
2017-08-11initialRobert
2017-08-03Merge branch '1726-WorkbenchImport-for-multi-Netex-import'Robert
2017-08-02ParentImportNotifier: Use `Import.finished_statuses`Teddy Wing
Instead of manually defining the finished statuses, use the method that's already defined on `Import` to get them. The only unfortunate part is that we now had to muss up our `Import` code and convert those methods to class methods in order for them to be accessible to `ParentImportNotifier` as well as its instance methods. Refs #3511
2017-08-02ParentImportNotifier: Simplify `#each` callTeddy Wing
This call can be written much more concisely. Thanks for the suggestion Robert! Refs #3511
2017-08-02ParentImportNotifier: Remove `self.` prefix when calling class methodTeddy Wing
Robert pointed out that it isn't necessary to prefix the method call with `self.`. Makes the code cleaner. Refs #3511
2017-08-01Unneeded FileService Implementation and Specs removed (deliberately after ↵Robert
merge to keep a reference in feature branch)
2017-08-01Add a service that notifies parent imports of sub-import statusTeddy Wing
A new service, `ParentImportNotifier`, will be called by a Cron job every 5 minutes. This service will query all finished sub-imports that haven't yet notified their parent, and tell them to do so. factories/workbench_imports.rb: Add a `WorkbenchImport` factory. This is currently incomplete. We'll want to correctly initialise the `file` attribute eventually. import.rb: factories/imports.rb: In order to get the test setup to work correctly, we skip the `before_create` callback on `Import`. This is because that callback initialises `status` to "new". We want to be able to set any status value in our tests to test things properly. Thus the callback messes with our buttermilk. For all imports created by the factory, skip this callback. In order to skip the callback, I had to put it in its own method and pass the method name to `#skip_callback`. That's why the callback is now in a new method in `Import`. Adds an empty `#notify_parent` method in `Import`. For now this doesn't do anything, but eventually it will be filled in to perform the actual notification. I this changeset, all we're doing is setting up the connecting logic to notify the right things from the Cron job. import_spec.rb: Remove the `.class_name` validation because we removed that previously in `Import`. The `belongs_to` is now a polymorphic association, with no class name specified. parent_import_notifier_spec.rb: Needed to use `create` instead of `build_stubbed` in a lot of these cases so that I could validate the query. Really don't like this because now this set of tests is SUPER SLOW. If you have any ideas for how to speed it up, let's do that. Refs #3511
2017-08-01Refs: #3507@2h; CR Step 4Robert
- Added tests for HTTPService (regression) - Removed some dead code (Workbench model spec, Import factory) - Changed front_end_host to rails_host in config
2017-07-31Refs: #3507@3h; CR finishedRobert
2017-07-31Refs: #3507_1726@6h Code ReviewRobert
2017-07-27Fixes: #3507@1.5h Retries & Error Handling in WorkbenchImportWorkerRobert
2017-07-27Refs: #3507@0.25h; Added information to retry callbacks in RetryService (for ↵Robert
logging)
2017-07-26Refs: #3507@1.5h; RetryService speced and implmentedRobert
2017-07-26Refs: #3507@4h; Finished Basic WorkbenchImportWorkerRobert
- speced but missing error treatment
2017-07-25Refs: #3507;20h Specing and Implementing the ZipServiceRobert