aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-08-01schedule.rb: Add cron job to update parent imports from child importsTeddy Wing
This task will run every 5 minutes, synchronising parent imports with the status of their children. When all children have finished, if none of them have failed, the parent import should get a status of "successful": WorkbenchImport status: :successful NetexImport status: :successful NetexImport status: :successful When all children have finished, if any of them have failed, the parent import should get a status of "failed": WorkbenchImport status: :failed NetexImport status: :failed NetexImport status: :successful We need a Cron job for this instead of being able to do it via a Ruby method because the thing that's setting the status on the sub-imports when they're complete is the STIF Java IEV application. Thus there's no way for our Ruby code to know that a sub-import has finished. Because of that, we do this polling mechanism every five minutes to update the imports that need updating. Created a Rake task to use in the Whenever schedule because the `runner` method from Whenever expanded to `script/rails`, which is a bloody ancient file, and tries to run via JRuby lolwat. Didn't want to bother adding a configuration to Whenever to use something more modern, and didn't know whether the binstub in `bin/` for `rails` is available since we don't commit those to the repo apparently (although I knew that fact from before). Refs #3511
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-01Import: Make `parent` field polymorphicTeddy Wing
Have Rails automatically fill in the `parent_id` and `parent_type` fields by declaring this as a polymorphic field. The type will always end up being "Import", but this is fine and will still allow us to use ActiveRecord in an easy way: https://stackoverflow.com/questions/9628610/why-polymorphic-association-doesnt-work-for-sti-if-type-column-of-the-polymorph#comment47744381_10820800 Refs #3511, #3555
2017-08-01Move `netex_import` factory to its own fileTeddy Wing
I briefly forgot that the `NetexImport` factory lived in the "imports.rb" factory file. Move it to its own file to make it easier to find. Refs #3511
2017-08-01Add `notified_parent_at` column to `imports` tableTeddy Wing
We need a way to detemine whether the parent of an import has been notified. We can already select all imports that have a parent and have finished with a failing status. We additionally need to be able to select only those imports that haven't notified their parent of having finished with a failing status. This field allows us to filter out only the sub-imports that haven't yet sent a notification call. The ultimate goal is to be able to enable the parent import to know that one of its sub-imports failed, and thus fail and potentially stop the parent import task. If one of the sub-imports fails the parent task is considered as having failed. Refs #3511
2017-08-01Remove "fixtures/ref1.zip" and "fixtures/ref2.zip"Teddy Wing
Seems like these files are no longer used. Originally they were meant to be used in tests for `WorkbenchImport`, but have been superseded by "single_reference_import.zip" and "multiple_reference_import.zip". Refs #3507
2017-08-01environments/development.rb: Update `rails_host` environment variableTeddy Wing
The config variable started out as `config.front_end_host`, but I requested that Robert change the name. It's now known as `config.rails_host`, but the corresponding environment variable stayed the same. Update the env variable to match the config variable. Refs #3507
2017-08-01Merge pull request #48 from af83/1726-WorkbenchImport-for-multi-Netex-importteddywing
1726 workbench import for multi netex import
2017-08-01Merge pull request #46 from af83/3507_1726_impl_workbench_importteddywing
3507 1726 impl workbench import
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-08-01Refs: #3507@0.3h; CR Step 4Robert
2017-08-01Update model diagram generationLuc Donnet
2017-07-31Merge branch 'master' into stagingLuc Donnet
2017-07-31Merge branch '3507_1726_impl_workbench_import' into ↵Robert
4176_1726_neteximp_autocreate_ref
2017-07-31Refs: #3507@3h; CR finishedRobert
2017-07-31Refs #4005 Period filters for time_table and referentialscedricnjanga
2017-07-31Refs: #3507@2h CR 2nd legRobert
2017-07-31Refs #4030: updating JP error displayjpl
2017-07-31Refs #4030: updating VJ error displayjpl
2017-07-31Refs #4187: updating routes#show tablejpl
2017-07-31Delete Timetable unnacessary methods and update specscedricnjanga
2017-07-31Refactoring of combination methods to manage int_day_types of another_ttcedricnjanga
2017-07-31Merge branch 'master' of github.com:AF83/stif-boivLuc Donnet
2017-07-31Fix routing constraint zones scope for index use line and not referential ↵Luc Donnet
Refs #4185 @1
2017-07-31Refs: #3507_1726@6h Code ReviewRobert
2017-07-29Refs: #4176@2h; Request Spec for NetexImport adapted and implementedRobert
- Specing that, in case of a correct request Referential & NetexImport instances are created and a 201 is returned - Specing that, in case of an incorrect request, no instance is created and a 406 with a correct error message is returned - Implemented MISSING: Refactor controller implmentation
2017-07-28Refs: #4176@1h; Specing Referential Creation on NetexImport API callRobert
2017-07-28Commit time gap over validation instead of setting it to falsecedricnjanga
2017-07-28Remove time gap over validation for vehiclejourneyscedricnjanga
2017-07-28Fix vehicle_journey_import specXinhui
2017-07-28Fix undefined method local_id for StifCodifligneAttributesSupport & ↵Xinhui
StifReflexAttributesSupport
2017-07-28Override local_id method for classes with specific formatXinhui
2017-07-28Edit factories to comply with new objectid formatXinhui
2017-07-28Fix objectid in group of line specXinhui
2017-07-28Refs #4184: updating tt_combination search fields autocomplete displayjpl
2017-07-28Fix undefined method local_id for StifCodifligneAttributesSupport & ↵Xinhui
StifReflexAttributesSupport
2017-07-27Refs: 3507@2.5h; Specing WorkbenchImportWorker failure and DB behaviorRobert
- speced and implemented Import instance behavior (status, total_steps, current_step) - failure behavior and it's impact to the above
2017-07-27Remove console.logcedricnjanga
2017-07-27Revert "Revert "Add short id in Ransack query for MissionSelect2""cedricnjanga
This reverts commit e6e6047d9240ffb54fb1989f68c2a6a388b7e66e.
2017-07-27Revert "Add short id in Ransack query for MissionSelect2"cedricnjanga
This reverts commit f27abef1479cf8fc14e78fdaa6d9d69aed0d8ba7.
2017-07-27Email layoutcedricnjanga
2017-07-27Add short id in Ransack query for MissionSelect2cedricnjanga
2017-07-27Refs #4183 update ransack query for TimetableSelect2cedricnjanga
2017-07-27Refs #4182 update TagSelect2 to return tags according to researchcedricnjanga
2017-07-27Edit access point to use new StifReflexAttributesSupportXinhui
2017-07-27Refs: #3507@0.5h; imports table migrated (2 step cols)Robert
2017-07-27Merge branch 'master' into stagingLuc Donnet
2017-07-27Fixes: #3507@1.5h Retries & Error Handling in WorkbenchImportWorkerRobert
2017-07-27Merge branch 'master' into 1726-WorkbenchImport-for-multi-Netex-importRobert
2017-07-27Merge branch 'master' of github.com:AF83/stif-boivLuc Donnet