| Age | Commit message (Collapse) | Author |
|
Use an `after_commit` instead of an `after_save`. The `after_save` could
cause intermittent problems due to Sidekiq starting before the
record/transaction actually gets committed to the database. In those
cases, the record wouldn't be found and cause an error.
With an `after_commit` callback, the record is sure to be committed
before Sidekiq takes over.
Additionally, limit the callback to `:create` and `:update` because
otherwise it will be active on `:destroy` by default also. This work
isn't relevant on destroy, so don't do it then.
Update the tests:
* Update labels
* Use `build` instead of `create` because we're saving the record at the
end anyway so we don't need an object that starts out persisted
* Use `truncation: true` for these tests because otherwise the `commit`
callback doesn't get called due to transactional teardown
Refs #6407
|
|
|
|
Add a sentinel in dev mode to help capture the "double positions" bug
|
|
|
|
|
|
GTFS import (first step)
|
|
|
|
|
|
6217 Add a method to fill blanks in journeys passing times
|
|
6226 Add a button to automatically create opposite routes
|
|
|
|
|
|
:warning: We'll have to refine this code once StopArea are linked to
workgroups
|
|
af83/6387-default-values-for-stop-point-alighting-boarding
6387 Default for enumerizes :for_boarding and :for_alighting
|
|
(blocks GTFS imports). Refs #6368
|
|
|
|
This can cause a bug when several forms are opened concurently
|
|
|
|
|
|
set_defaults method
|
|
|
|
|
|
When a passing time at a border can be extrapolated from other values.
|
|
|
|
|
|
section status fron Chouette::JourneyPattern
|
|
confirmed_at. Refs #6141
|
|
We say `TomTom` is disabled when no API key is present. If this is the
case, the `after_save` callback that uses it shouldn't be executed.
I had to change my `API_KEY` constant to an instance variable to be able
to change it for testing.
Refs #6095
|
|
Johan suggested simplifying this method by changing the `slice` call:
http://api.rubyonrails.org/classes/Hash.html#method-i-slice-21
I had modified this to fix the whitespace while working on the `WayCost`
calculation function for `Chouette::Route`s, so don't really have a
brain cache hit on this code, but the change makes sense and seems to
work.
Refs #6095
|
|
Just running `Chouette::Route.find(id)` doesn't give us anything if we
don't have a `Referential` selected. In order to properly get the
correct route, pass the referential ID to the worker and switch to that
referential before trying to select the route.
Refs #6095
|
|
Not efficient to send a request to the TomTom API every time we save a
Route, but I'm banking on developing a cache system soon to avoid having
to make the requests, so hopefully that will stop this from making
expensive remote calls all the time.
Refs #6095
|
|
This method wasn't indented to the same level as the rest of the file.
Refs #6095
|
|
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
|
|
Refs #6095
|
|
|
|
Fix VehicleJourney#with_ordered_stop_area_ids scope. Refs #6006
|
|
|
|
|
|
Add detailed view for purchase windows. Refs #6042
|
|
|
|
And fix the way offsets are computed to use the timezones
|
|
|
|
|
|
|
|
Thanks to Johan for helping me with this. He correctly remarked that
what I had before will do an `INNER JOIN`, which ends up excluding lines
that don't have an associated company. I didn't really think about the
data, and didn't realise we had lines without a company.
Big thanks to Johan for seeing that I needed to add `public.` to qualify
the `companies` table in order for the join to work. Otherwise it
doesn't work correctly and we can't filter by company name.
Refs #5889
|
|
Johan made a number of good points here:
> * I think this belongs in the model
> * I would rather use a named parameter here
> `.where('lines.number LIKE :q OR lines.names LIKE :q ...', q: > "%#{params[:q]}%")`
> * You should defiitely escape the params before passing it to your db.
> `sanitize_sql_like` seems like the best choice here
I wasn't thinking about sanitisation at all and just assumed the `?`s in
the prepared statement would take care of it for me. But obviously,
we're passing `%`s in the param, so users can of course do the same
thing.
Protect against this using the
`ActiveRecord::Sanitization#sanitize_sql_like` method. This is a private
class method, so in order to use it we have to call it from inside the
`Chouette::Line` model.
And of course the named parameters are a no-brainer. At the time, I had
seen that `Array` splat somewhere else in the codebase and just blindly
copied the format, forgetting that named parameters even existed.
Refs #5889
|
|
This is no longer needed thanks to the `AutocompleteLinesController` and
the AJAX filter in
`app/views/referential_vehicle_journeys/_filters.html.slim`.
Refs #5889
|
|
Instead of doing a complex query to get the lines available to filter
on, just get all the lines in the current referential. We then filter
those by what was typed into the select2 box and asynchronously respond
with line options in a new JSON autocomplete controller.
Here we're only providing the option to filter by `number` and `name`
field on the line. I'd like to filter by everything in the
`#display_name`. I don't think the objectid is going to be easy to
integrate into the SQL query but I'd like to add the company part. It's
possible we could do the objectid filter in Ruby instead of the database
query.
Refs #5889
|
|
Simple exporter. Refs #6068
|
|
|