| Age | Commit message (Collapse) | Author | 
 | 
 | 
 | 
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
 | 
 | 
Avoid problem with numeric in slug. Refs #5609 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
af83/5911-stops-filter-on-referential-journeys-index
Better stops filters on ReferentialVJs#index. Refs #5911 
 | 
 | 
5863 Remove workbench id from the querystring
 | 
 | 
Infer it when possible, and use a nested otherwise
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
- The checksum computing for VehicleJourneyAtStops
- Offsets calculation in VehicleJourneys
 | 
 | 
Mostly add a way to override the default behaviour and process each row
its own way
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
Make ReferentialVJs#index sortable. Refs #5919 
 | 
 | 
 | 
 | 
5416 checksum attribute
 | 
 | 
 | 
 | 
4963 import cron should abort old imports
 | 
 | 
 | 
 | 
af83/4758-cron-job-to-finalise-compliance_check_set-validations--
4758 cron job to finalise compliance check set validations  
 | 
 | 
5815 add required fields for cc
 | 
 | 
 | 
 | 
Make `#checksum_replace_nil_or_empty_values` more readable.
Refs #5416
 | 
 | 
Add Johan's suggestion for simplifying this line. This allows us to get
rid of one of the `#map` calls.
Refs #5416
 | 
 | 
Copy over the `Import.abort_old` method to this class. For now I haven't
bothered with moving it to a consolidated module. We'll see, maybe
that's a better approach. For now I'm going with a relaxed copy-paste
solution until we decide that the increased complexity of the module is
worth the deduplication.
We need this method to be able to abort stale imports. We'll be doing
this, similarly to imports, in a regular cron job.
Refs #4758
 | 
 | 
 | 
 | 
Refs #5416
 | 
 | 
Refs #5416
 | 
 | 
 | 
 | 
 | 
 | 
This determines if the StopArea is commercial or not
The useless fields are hidden in the form for the non-commercials ones
 | 
 | 
 | 
 | 
 | 
 | 
This determines if the StopArea is commercial or not
The useless fields are hidden in the form for the non-commercials ones
 | 
 | 
We were getting this error on `ReferentialVehicleJourneys#index`:
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Started GET "/referentials/9/vehicle_journeys" for 172.28.10.14 at 2018-02-01 17:48:32 +0100
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Processing by ReferentialVehicleJourneysController#index as HTML
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Parameters: {"referential_id"=>"9"}
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: locale set to :fr
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Rendered referential_vehicle_journeys/_filters.html.slim (37.0ms)
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Rendered referential_vehicle_journeys/index.html.slim within layouts/application (54.3ms)
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Completed 500 Internal Server Error in 73ms (ActiveRecord: 10.4ms)
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: ActionView::Template::Error (missing attribute: kind):#012    23:         = f.input :published_journey_name_lteq, label: false, wrapper_html: { class: 'w45'}#012    24:     .form-group.togglable#012    25:       = f.label Chouette::StopArea.model_name.human.pluralize, required: false, class: 'control-label'#012    26:       = f.input :stop_area_ids, collection: @all_stop_areas.select(:id, :name).order(name: :asc), checked: params[:q] && params[:q][:stop_area_ids], as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}, multiple: true#012    27:     .form-group.togglable#012    28:       = f.label Chouette::VehicleJourney.human_attribute_name(:purchase_window), class: 'control-label'#012    29:       .filter_menu#012  app/models/chouette/stop_area.rb:51:in `block in <class:StopArea>'#012  app/views/referential_vehicle_journeys/_filters.html.slim:26:in `block in _app_views_referential_vehicle_journeys__filters_html_slim__692539656386688985_47285414929500'#012  app/views/referential_vehicle_journeys/_filters.html.slim:1:in `_app_views_referential_vehicle_journeys__filters_html_slim__692539656386688985_47285414929500'#012  app/views/referential_vehicle_journeys/index.html.slim:9:in `_app_views_referential_vehicle_journeys_index_html_slim___336434325333090796_47285419865660'
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Processing by ErrorsController#server_error as HTML
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: Parameters: {"referential_id"=>"9"}
    Feb  1 17:48:32 chouette-dev rails/chouette[18900]: locale set to :fr
or, this one locally which is easier to read:
    ActiveModel::MissingAttributeError in ReferentialVehicleJourneys#index
    Showing .../stif-boiv/app/views/referential_vehicle_journeys/_filters.html.slim where line #44 raised:
    missing attribute: kind
    Extracted source (around line #51):
        after_initialize do
    >     self.kind ||= :commercial
        end
        def self.nullable_attributes
    Trace of template inclusion: app/views/referential_vehicle_journeys/index.html.slim
    Rails.root: .../stif-boiv
    Application Trace | Framework Trace | Full Trace
    app/models/chouette/stop_area.rb:51:in `block in <class:StopArea>'
    app/views/referential_vehicle_journeys/_filters.html.slim:44:in `block in _app_views_referential_vehicle_journeys__filters_html_slim___131528464712770693_70134715599760'
    app/views/referential_vehicle_journeys/_filters.html.slim:1:in `_app_views_referential_vehicle_journeys__filters_html_slim___131528464712770693_70134715599760'
    app/views/referential_vehicle_journeys/index.html.slim:9:in `_app_views_referential_vehicle_journeys_index_html_slim__3124451149445015007_70134715309040'
This is because on `ReferentialVehicleJourneys#index`, the StopArea
filter makes this query:
    @all_stop_areas.select(:id, :name).order(name: :asc)
Alban added a temporary fix for the release in
c2bc391ee91cac70e726d188be97dd2323df0df2.
After a discussion with Luc, he said we only want the initial value on
the `#new` form, and we decided to take this out of the model and put it
in the form template instead.
Here, when a new `StopArea` is created, `:commercial` will be pre-filled
in the `kind` field by default. On the `#edit` page, it should show the
existing value of `kind` but not permit editing.
Refs #5817
 | 
 | 
 | 
 | 
 |