| Age | Commit message (Collapse) | Author | 
|---|
|  |  | 
|  |  | 
|  |  | 
|  | 5878 Add ComplianceCheck#show | 
|  |  | 
|  | #5878 @1 | 
|  | Use InheritedResources helpers | 
|  | ComplianceControl | 
|  | Refs #5979 Change export CSV filenames to have a readable date in it | 
|  | Refs #5882 Fix CC name and code filter | 
|  | af83/5950_allow_user_to_see_ccset_from_other_organisation
Refs #5950 Fix 404 error when user wants to see CCSet from other orga… | 
|  | 6026 Use SEED_ENV in seedbank, fallback on Rails.env | 
|  | later compliance_control_set selected by stif organisatoon Refs #5950 @2 | 
|  |  | 
|  |  | 
|  |  | 
|  | Refs #6040 | 
|  |  | 
|  | - remove begin_association_chain in controller
- Change collecyion to only see user organisayion CCSet and STIF CCSet
- add policy for show action | 
|  |  | 
|  |  | 
|  | Refs #6010 | 
|  |  | 
|  | af83/5943-referential-vehicle_journeys-index--query-error-when-fi
VehicleJourney#in_purchase_window: Use table namespace in query. Refs #5943 | 
|  | We were getting this errorwhen filtering by purchase window on the
`ReferentialVehicleJourneys#index` page.
An example of a filter query that triggered the error:
http://stif-boiv.dev:3000/referentials/4/vehicle_journeys?utf8=✓&q[published_journey_name_or_objectid_cont]=&q[company_id_eq_any][]=&q[route_line_id_eq]=&q[published_journey_name_gteq]=&q[published_journey_name_lteq]=&q[stop_area_ids][]=&q[purchase_window][start_date(3i)]=12&q[purchase_window][start_date(2i)]=1&q[purchase_window][start_date(1i)]=2018&q[purchase_window][end_date(3i)]=15&q[purchase_window][end_date(2i)]=1&q[purchase_window][end_date(1i)]=2019&q[time_table][start_date(3i)]=&q[time_table][start_date(2i)]=&q[time_table][start_date(1i)]=&q[time_table][end_date(3i)]=&q[time_table][end_date(2i)]=&q[time_table][end_date(1i)]=&commit=Filtrer
    ActiveRecord::StatementInvalid in ReferentialVehicleJourneys#index
    Showing stif-boiv/app/views/referential_vehicle_journeys/_filters.html.slim where line #24 raised:
    PG::AmbiguousColumn: ERROR:  column reference "id" is ambiguous
    LINE 1: ...RE "vehicle_journeys"."journey_category" = 0 AND (id IN (SEL...
                                                                 ^
    : SELECT "public"."lines".* FROM "public"."lines" WHERE (id IN (SELECT  routes.line_id FROM "vehicle_journeys" INNER JOIN "routes" ON "routes"."id" = "vehicle_journeys"."route_id" WHERE "vehicle_journeys"."journey_category" = 0 AND (id IN (SELECT DISTINCT vehicle_journeys.id FROM "purchase_windows" INNER JOIN "purchase_windows_vehicle_journeys" ON "purchase_windows_vehicle_journeys"."purchase_window_id" = "purchase_windows"."id" INNER JOIN "vehicle_journeys" ON "vehicle_journeys"."id" = "purchase_windows_vehicle_journeys"."vehicle_journey_id" AND "vehicle_journeys"."journey_category" = 0 WHERE (daterange('2018-01-12', '2019-01-16') && any (date_ranges))))  ORDER BY "vehicle_journeys"."published_journey_name" ASC LIMIT 10 OFFSET 0))
    Extracted source (around line #24):
              class: 'control-label'
          .form-inline.filter_menu
            = f.input :route_line_id_eq,
                as: :select,
                include_blank: t(".all"),
                collection: @vehicle_journeys.lines,
    Trace of template inclusion: app/views/referential_vehicle_journeys/index.html.slim
We're trying to match `VehicleJourney`s here, so qualify the `id` column
with the table name to fix the error.
Refs #5943 | 
|  |  | 
|  |  | 
|  | Homogenize calendars display. Refs #5993 | 
|  |  | 
|  | Add a locale selector menu item. Refs #5398 | 
|  |  | 
|  |  | 
|  |  | 
|  | Change ReferentialVJs#index when filtered by stops. Refs #5995. Refs #5996. Refs #5852 | 
|  |  | 
|  | ReferentialVehicleJourneys#index. Refs #5996. Refs #5852 | 
|  | Avoid problem with numeric in slug. Refs #5609 | 
|  |  | 
|  |  | 
|  | Apply user tz. Refs #5942 | 
|  |  | 
|  | I was getting this error when I removed the `rescue nil`s:
    Failures:
      1) WorkbenchImportWorker foreign lines uploads the following entries: ["OFFRE_TRANSDEV_20170301122517", "OFFRE_TRANSDEV_20170301122519"]
         Failure/Error: eg_file.unlink
         NoMethodError:
           undefined method `unlink' for #<File:0x007fef1adbace8>
         # ./app/workers/workbench_import_worker.rb:81:in `upload_entry_group_stream'
         # ./app/workers/workbench_import_worker.rb:52:in `upload_entry_group'
         # ./app/services/zip_service.rb:61:in `<<'
         # ./app/services/zip_service.rb:61:in `finish_current_output'
         # ./app/services/zip_service.rb:35:in `add_entry'
         # ./app/services/zip_service.rb:27:in `block in _subdirs'
         # .../.gem/ruby/2.3.3/gems/rubyzip-1.2.1/lib/zip/entry_set.rb:38:in `block in each'
         # .../.gem/ruby/2.3.3/gems/rubyzip-1.2.1/lib/zip/entry_set.rb:37:in `each'
         # .../.gem/ruby/2.3.3/gems/rubyzip-1.2.1/lib/zip/entry_set.rb:37:in `each'
         # .../.gem/ruby/2.3.3/gems/rubyzip-1.2.1/lib/zip/central_directory.rb:182:in `each'
         # ./app/services/zip_service.rb:26:in `_subdirs'
         # .../.gem/ruby/2.3.3/gems/rubyzip-1.2.1/lib/zip/file.rb:133:in `open_buffer'
         # ./app/services/zip_service.rb:21:in `block in subdirs'
         # ./app/workers/workbench_import_worker.rb:39:in `each'
         # ./app/workers/workbench_import_worker.rb:39:in `each_with_index'
         # ./app/workers/workbench_import_worker.rb:39:in `upload'
         # ./app/workers/workbench_import_worker.rb:19:in `perform'
         # ./spec/workers/workbench_import_worker_spec.rb:68:in `block (4 levels) in <top (required)>'
         # ./spec/workers/workbench_import_worker_spec.rb:68:in `block (3 levels) in <top (required)>'
         # ./spec/workers/workbench_import_worker_spec.rb:13:in `instance_eval'
         # ./spec/workers/workbench_import_worker_spec.rb:13:in `block in expect_upload_with'
         # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
         # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load'
         # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
         # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load'
         # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call'
         # -e:1:in `<main>'
Johan said that in his tests on his local machine, the temp files
weren't getting deleted. When I try running the specs, the temp files do
get deleted, so not sure what was going on. Figure it may be because of
the `rescue nil`s, so I decided to remove those in the hopes of always
ensuring we close and unlink the temp files.
The trouble with doing that, however, was that it caused the error and
thus test failures like the example above. I managed to fix the problem
by using `File.unlink` instead of the instance method.
Hopefully this works to ensure that the temp files are always deleted.
Refs #4315 | 
|  | If the directory doesn't exist, we should create it to ensure we don't
get errors trying to write to a location that doesn't exist. I had
removed this because I assumed the dir would be created during
deployment, but I guess I shouldn't assume. Also, we want to ensure the
dir gets created on dev machines without errors.
This line is updated from last time where we'd create
`Rails.root.join('tmp', 'imports')`. Now we use our `#temp_directory`,
which can be variable.
Refs #4315 | 
|  | Instead of creating our own files for these subdirectory Zip files, use
temp files.
There are two advantages to doing this:
1. We can customise the location they get saved to. This means we can
   use `Rails.root` as a default, but specify a custom location in a
   Rails config variable.
2. The files will be automatically deleted on every garbage collection.
In actuality, #2 above was already handled by the `eg_file.unlink` line,
and #1 could be easily added to the existing code.
Using a `Tempfile`, though, makes the fact that these are temporary
files more explicit.
The reason why we want to be able to customise the location of these
tempfiles is that in our production environment set up by Puppet, the
`#{Rails.root}/tmp/imports` directory isn't writable by the application,
which causes this code to error. We thus want a way to change the path
in different environments.
We keep the `eg_file.unlink` call here because we want the temporary
file to be deleted as soon as possible. The Ruby documentation even
recommends it
(https://ruby-doc.org/stdlib-2.5.0/libdoc/tempfile/rdoc/Tempfile.html#class-Tempfile-label-Explicit+close):
> it's good practice to do so: not explicitly deleting unused Tempfiles
> can potentially leave behind large amounts of tempfiles on
> the filesystem until they're garbage collected.
I got rid of the `#upload_entry_group_tmpfile` method in this change,
moving its contents to `#upload_entry_group_stream`. This was easy
enough to do since it was only called in that one place. The reason I
did this is because it took an open `File` object as an argument and
closed the file at the end of the method. That's a major side effect. I
don't think the method should be closing a file it doesn't own. After
moving this work to `#upload_entry_group_stream`, we can close and
unlink the file in the same place where it was created.
Refs #4315 | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | a transport mode |