aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-07-21VehicleJourneyAtStop spec: Remove unnecessary initial valuesTeddy Wing
I had created an at-stop with nil `arrival_day_offset` and `departure_day_offset` values because that's the kind of object this test is testing, but when I reviewed the code, it occurred to me that since the method takes the offset as an argument, it isn't necessary to provide these attribute values to the factory. Not sure whether it's clearer this way or the way it was before, but I figured since they're not necessary it may be better to remove them. Refs #3597
2017-07-21VehicleJourney: Remove 'departure time before arrival time' validationTeddy Wing
Remove the `#vjas_departure_time_must_be_before_next_stop_arrival_time` validation. This prevented vehicle journeys from being saved if they contained at-stops with a day offset > 0. For example: Arrival | Departure 23:30 | 23:30 00:05 | 00:05 should work because 00:05 is on the next day, but it doesn't because the validation sees it as !(23:30 < 00:05). Luc says we should remove this validator in order for the day offsets to work. He instructed me to comment the code instead of removing it outright, because we're not sure yet what we want to do with this, and he needs to look into the use-case for the validation. It could be that we completely remove the validation method, or maybe we modify it somewhat to play nicely with day offsets. Skip the tests that check this validation method because we've commented out the validation. Add a test to check that saving a vehicle journey with a positive at-stop day offset works (it failed before commenting out the validation). Unfortunately it seemed too complicated to use `build_stubbed` in my new test, so I gave up and just used `create`. Sorry test speedsters. Maybe you can refactor something more enlightened. Refs #3597
2017-07-21VehicleJourneyAtStop: Handle nil value when checking offset within rangeTeddy Wing
Old `VehicleJourneyAtStop`s were created before I added a database default of 0 to those records. Thus old data will not have the proper 0 value to check against, and our `<` `>` comparisons trigger an error due to a comparison with `nil`. To get around the error, set a default value of 0 (the current day) when the offset isn't set. I think that ideally this should be solved at the database level with a data migration, but hopefully this is okay for now. Whenever we do decide to do a data migration, however, this code needs to be deleted. Refs #3597
2017-07-21VehicleJourneyAtStop spec: Update spec name to match method nameTeddy Wing
I had changed the method name during development to add a question mark at the end, but forgot to update the test to reflect the new naming. Refs #3597
2017-07-21VehicleJourneyAtStop spec: Move stubbed at-stop to `let`Teddy Wing
Robert asked me to move the duplicated factory call to a `let` block to get rid of the duplication in the tests. Personally I'm not a huge fan of `let`s, but am following his recommendation here. Refs #3597
2017-07-21VehicleJourneyAtStop: Remove `error_message` from day offset validatorTeddy Wing
Robert wasn't a fan of the lambda in code review, so I'm getting rid of it and just duplicating the I18n call. Refs #3597
2017-07-21VehicleJourneyAtStop: Remove "nested" #error_message methodTeddy Wing
Robert adeptly pointed out that my `#error_message` method is not a nested method, like I had thought, à la Python. Instead, it actually defines the `#error_message` method on the class at runtime (https://stackoverflow.com/questions/4864191/is-it-possible-to-have-methods-inside-methods/4865161#4865161), so `#error_message` becomes a normal instance method after `#day_offset_must_be_within_range` is called. I did not know this, and that's certainly not what I was going for. Convert the method to a lambda to put it in the local scope. Refs #3597
2017-07-21VehicleJourneyAtStop: Add new specs for day offset validationTeddy Wing
Replace our numericality validation tests with an equivalent set of tests since we're now using a custom validation function. Move `#outside_range` into the class scope so we can test it. Ignoring model validation tests and hooking into this method as the "real" important validator. Refs #3597
2017-07-21VehicleJourneyAtStop: Add validation messages to day offset validatorTeddy Wing
Since we can't use the lambda syntax when passing a message to a validator, write a custom validation method that allows us to be more flexible when setting a message. The correct message with the correct data is now used for the offset error. This eliminates our validation of `numberiality`, making our two validation specs no longer valid. Refs #3597
2017-07-21VehicleJourneyAtStop: Add error message to max day offset errorTeddy Wing
Add a custom error message for when the day offset exceeds our maximum. Unfortunately, this uses Rails 5 lambda syntax, so it doesn't work. Will need to extract it to a method, but figured I'd just commit this anyway for posterity. The French error message text was taken from the Redmine issue, authored by Luc. I translated it into English. Refs #3597
2017-07-21VehicleJourneyAtStop: Validate day offsets are not greater than 1 dayTeddy Wing
We want to ensure day offsets can only be used to make at-stops for the current day and the next day. Any more days are declared to be invalid. For now, with bus and rail modes of transportation, we don't plan on having journeys that extend beyond a day after the initial departure. Also prevent setting negative day offsets while we're at it because it goes in the same validation block and we should allow have those. Refs #3597
2017-07-21Fix cloned ref should belong to current user organisationXinhui
Refs #4132
2017-07-21Fix referentials count in homepage Refs #4136 @1Luc Donnet
2017-07-20Refs: #3507@1hRobert
Introduction of Presence Validation in Import model, for: - workbench - referential
2017-07-20Refs: #3507@1h; Merge with 1726_... and validations on NetexImportRobert
2017-07-20merge conflicts resolvedRobert
2017-07-20Fix SMTP to address not found for delayed jobXinhui
Refs #2263
2017-07-20Merge branch '1726-WorkbenchImport-for-multi-Netex-import' of ↵Robert
github.com:af83/stif-boiv into 1726-WorkbenchImport-for-multi-Netex-import
2017-07-20Merge remote-tracking branch 'origin/master' into ↵Teddy Wing
1726-WorkbenchImport-for-multi-Netex-import
2017-07-20Merge pull request #36 from af83/3506_1726_api_create_netex_importsteddywing
3506 1726 api create netex imports
2017-07-20bup working on WorkbenchImportWorker's integration spec [amend me]Robert
2017-07-20Fixes: #3506@0.5hRobert
* CR refacts (netex_import req spec) * Dead Code Elimination (mount in Import subclasses)
2017-07-20Refs #4113: fix display bug on selected items result (VJ select2 comp.)jpl
2017-07-20Refs: #3506@1.5h; server debuggingRobert
- Fixed conf error (missing schema in `config.iev_url`) - Reported java server traces (looks like missing metadata)
2017-07-19Fix errors from JS-formatted templates using the table_builderTeddy Wing
We were getting errors like these: Started GET "/referentials/4/networks?_=1500482065840" for 127.0.0.1 at 2017-07-19 18:34:27 +0200 Processing by ReferentialNetworksController#index as JS Parameters: {"_"=>"1500482065840", "referential_id"=>"4"} User Load (3.6ms) SELECT "public"."users".* FROM "public"."users" WHERE "public"."users"."id" = $1 ORDER BY "public"."users"."id" ASC LIMIT 1 [["id", 1]] locale set to :fr Organisation Load (5.6ms) SELECT "public"."organisations".* FROM "public"."organisations" WHERE "public"."organisations"."id" = $1 LIMIT 1 [["id", 1]] Referential Load (1.0ms) SELECT "public"."referentials".* FROM "public"."referentials" WHERE "public"."referentials"."organisation_id" = $1 AND "public"."referentials"."id" = $2 LIMIT 1 [["organisation_id", 1], ["id", 4]] Workbench Load (0.7ms) SELECT "public"."workbenches".* FROM "public"."workbenches" WHERE "public"."workbenches"."id" = $1 LIMIT 1 [["id", 1]] (1.3ms) SELECT DISTINCT COUNT(DISTINCT "public"."networks"."id") FROM "public"."networks" INNER JOIN "public"."line_referentials" ON "public"."networks"."line_referential_id" = "public"."line_referentials"."id" WHERE "public"."line_referentials"."id" = $1 [["id", 1]] CACHE (0.0ms) SELECT DISTINCT COUNT(DISTINCT "public"."networks"."id") FROM "public"."networks" INNER JOIN "public"."line_referentials" ON "public"."networks"."line_referential_id" = "public"."line_referentials"."id" WHERE "public"."line_referentials"."id" = $1 [["id", 1]] Chouette::Network Load (2.3ms) SELECT DISTINCT "public"."networks".* FROM "public"."networks" INNER JOIN "public"."line_referentials" ON "public"."networks"."line_referential_id" = "public"."line_referentials"."id" WHERE "public"."line_referentials"."id" = $1 ORDER BY name asc LIMIT 12 OFFSET 0 [["id", 1]] CACHE (0.0ms) SELECT DISTINCT COUNT(DISTINCT "public"."networks"."id") FROM "public"."networks" INNER JOIN "public"."line_referentials" ON "public"."networks"."line_referential_id" = "public"."line_referentials"."id" WHERE "public"."line_referentials"."id" = $1 [["id", 1]] Chouette::Network Exists (1.2ms) SELECT 1 AS one FROM "public"."networks" WHERE "public"."networks"."id" = $1 LIMIT 1 [["id", 118]] Rendered referential_networks/index.html.slim (48.9ms) Completed 500 Internal Server Error in 184ms (ActiveRecord: 17.4ms) ActionView::Template::Error (undefined method `action_links' for #<Chouette::Network:0x007ffea2148b08>): 22: - if @networks.any? 23: .row 24: .col-lg-12 25: = table_builder_2 @networks, 26: [ \ 27: TableBuilderHelper::Column.new( \ 28: name: 'ID Codifligne', \ app/helpers/table_builder_helper.rb:161:in `block in build_links' app/helpers/table_builder_helper.rb:158:in `build_links' app/helpers/table_builder_helper.rb:138:in `block (3 levels) in tbody' app/helpers/table_builder_helper.rb:110:in `block (2 levels) in tbody' app/helpers/table_builder_helper.rb:108:in `block in tbody' app/helpers/table_builder_helper.rb:107:in `tbody' app/helpers/table_builder_helper.rb:72:in `table_builder_2' app/views/referential_networks/index.html.slim:25:in `_app_views_referential_networks_index_html_slim___1557411244315414919_70366016986820' app/controllers/referential_networks_controller.rb:27:in `index' Rendered .../lib/ruby/gems/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (1.8ms) Rendered .../lib/ruby/gems/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (2.5ms) Rendered .../lib/ruby/gems/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb (76.0ms) on the following pages: - http://stif-boiv.dev:3000/referentials/4/time_tables - http://stif-boiv.dev:3000/line_referentials/1/companies - http://stif-boiv.dev:3000/line_referentials/1/networks - http://stif-boiv.dev:3000/referentials/4/companies - http://stif-boiv.dev:3000/referentials/4/networks This was caused by the request of a JS-formatted view that rendered the HTML template, since the collection decoration only happened in the HTML format section. Do the decoration in both the HTML format and JS format for the relevant controllers in order to eliminate this error. Maybe there's a cleaner way to do this than just duplicating the decoration in both `format.X` blocks, but I don't know of it. Wanted to make sure not to decorate when it wasn't necessary, like when rendering other formats (XML, etc.). Refs #4105
2017-07-19Refs: #3506@1h; Code ReviewRobert
2017-07-19Refs #4128: updating autocomplete component results displayjpl
2017-07-19Refs: #3507@0.25h (actually it was e/10, but let's round down) Scaffolding ↵Robert
out the WorkbenchImport model
2017-07-19Refs 4131 Change Timetable#create to fetch all Calendars (new_from)cedricnjanga
2017-07-19Refs #4129 Change minimumInputLength for VJ select2cedricnjanga
2017-07-19Adapt test for clone policies changes (user from different organisation)cedricnjanga
2017-07-19Remove organisation_match for clone? in Referential policycedricnjanga
2017-07-19dead code eliminatedRobert
2017-07-19Add `WorkbenchImport` modelTeddy Wing
A new model that represents a batched import. The zip archive attached to this record will contain one or more datasets. A `Referential` will be created for each dataset in the zip, and that sub-dataset will be scheduled for a Netex import (only handling Netex imports at the moment). The model is currently empty but I'm committing it now so it can be used by others on the team. Refs #3507
2017-07-19Refs: #3506@16h Request Spec for NetexImport API and implementationRobert
- Carrier Wave Upload with `fixture_file_upload` - Request specs to .json - Implementation - API token setup - Refuted experiments with controller specs
2017-07-18Refs #4112: updating and fixing I18njpl
2017-07-18Tmp fix build_objectid update objectid without validationXinhui
Refs #4092
2017-07-18Tmp fix build_objectid update objectid without validationjpl
Refs #4092
2017-07-18Refs #4114: updating MissionSelect2 on VJjpl
2017-07-18Refs #4108: updating layout according to new specsjpl
2017-07-18Refs #4113: updating calendar filter on VJjpl
2017-07-18Refs #4108: updating viewjpl
2017-07-18Update erd config generation to use in stif documentationLuc Donnet
2017-07-18Merge branch 'master' of github.com:AF83/stif-boivLuc Donnet
2017-07-18Update i18-tasks configurationLuc Donnet
2017-07-18Merge branch 'master' of github.com:af83/stif-boivRobert
2017-07-18hotfix fixes #4111@0.5hRobert
2017-07-17No need to specify queue for mailers job there is already mailers queue ↵Luc Donnet
defined in delivery_job.rb in actionmailer
2017-07-17Merge branch 'master' of github.com:AF83/stif-boivLuc Donnet
2017-07-17Fix sidekiq filename in configLuc Donnet