<feed xmlns='http://www.w3.org/2005/Atom'>
<title>chouette-core/spec/lib, branch 6979-ruby-controls-sets</title>
<subtitle>Chouette manage transport static data</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/'/>
<entry>
<title>Refs #6979; Flag controls intended to be handled by the Java third-party app</title>
<updated>2018-06-01T10:10:11+00:00</updated>
<author>
<name>Zog</name>
</author>
<published>2018-06-01T10:10:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=1e6b830a083e4c30f9f65c7fa51a9f066742f66d'/>
<id>1e6b830a083e4c30f9f65c7fa51a9f066742f66d</id>
<content type='text'>
And prevent calls to the java API when it is not needed
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
And prevent calls to the java API when it is not needed
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #553 from af83/6884-tomtom-matrix--handle-error-when-response-doesn,t-inclu</title>
<updated>2018-05-16T13:42:24+00:00</updated>
<author>
<name>Alban Peignier</name>
</author>
<published>2018-05-16T13:42:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=223d988ef59e562b201cac8391c397630c8953e5'/>
<id>223d988ef59e562b201cac8391c397630c8953e5</id>
<content type='text'>
Handle API error(s) in Tomtom matrix. Fixes #6884</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Handle API error(s) in Tomtom matrix. Fixes #6884</pre>
</div>
</content>
</entry>
<entry>
<title>Test api_key format in TomTom.enabled?. Refs #6993</title>
<updated>2018-05-13T11:52:00+00:00</updated>
<author>
<name>Alban Peignier</name>
</author>
<published>2018-05-13T11:52:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=6c4f6e6232b4423c1161e1c2ab4d3fcac860dee2'/>
<id>6c4f6e6232b4423c1161e1c2ab4d3fcac860dee2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Move `TomTom::Matrix::RemoteError` to`TomTom::Errors::MatrixRemoteError`</title>
<updated>2018-05-04T10:54:25+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-05-04T10:49:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=9c442cd66c7d12266ba53e85949f775f6b842d2d'/>
<id>9c442cd66c7d12266ba53e85949f775f6b842d2d</id>
<content type='text'>
I previously tried to correct a circular dependency problem in
a057276129b1f62b811743db3b8f867a05241ed3, but that didn't fix it (it was
intermittent, and came back).

After some wrangling, I've now deduced with some confidence that the
problem comes from `RouteWayCostCalculator`, which used
`TomTom::Matrix::RemoteError`. From the way it looks, this seems to mess
up the Rails autoloader since `tom_tom.rb` will try to load the `Matrix`
class from the `TomTom.matrix` call above. Or something.

In an attempt to fix the circular dependency error for real this time,
move the error class to a completely separate module from `Matrix`, and
refer to this when we need to use the error class.

Refs #6884
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I previously tried to correct a circular dependency problem in
a057276129b1f62b811743db3b8f867a05241ed3, but that didn't fix it (it was
intermittent, and came back).

After some wrangling, I've now deduced with some confidence that the
problem comes from `RouteWayCostCalculator`, which used
`TomTom::Matrix::RemoteError`. From the way it looks, this seems to mess
up the Rails autoloader since `tom_tom.rb` will try to load the `Matrix`
class from the `TomTom.matrix` call above. Or something.

In an attempt to fix the circular dependency error for real this time,
move the error class to a completely separate module from `Matrix`, and
refer to this when we need to use the error class.

Refs #6884
</pre>
</div>
</content>
</entry>
<entry>
<title>TomTom::Matrix#check_for_error_response: Handle HTTP error status codes</title>
<updated>2018-05-03T16:25:57+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-05-03T16:21:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=ad49ad52ee8e7cfbf4dc3f1bc34c533e186100b9'/>
<id>ad49ad52ee8e7cfbf4dc3f1bc34c533e186100b9</id>
<content type='text'>
We might not always get a nicely formatted JSON
`['error']['description']` response body. Sometimes, like for example
when you use an incorrect API key, even with an 'application/json'
content type, TomTom will respond with:

    &lt;h1&gt;Developer Inactive&lt;/h1&gt;

What?

In that case, the response has a 403 status. In addition to checking for
an error in the response, should also be checking for the HTTP status
code.

Log the status code in the exception to give us more information about
what went wrong.

Update our existing tests now that `#check_for_error_response` takes a
response object instead of a JSON string.

Refs #6884
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We might not always get a nicely formatted JSON
`['error']['description']` response body. Sometimes, like for example
when you use an incorrect API key, even with an 'application/json'
content type, TomTom will respond with:

    &lt;h1&gt;Developer Inactive&lt;/h1&gt;

What?

In that case, the response has a 403 status. In addition to checking for
an error in the response, should also be checking for the HTTP status
code.

Log the status code in the exception to give us more information about
what went wrong.

Update our existing tests now that `#check_for_error_response` takes a
response object instead of a JSON string.

Refs #6884
</pre>
</div>
</content>
</entry>
<entry>
<title>TomTom::Matrix spec: Fix typo 'an' -&gt; 'a'</title>
<updated>2018-05-03T15:15:37+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-05-03T15:15:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=bfc4fab8943a28d2f30084a38d88678d7bfbbac4'/>
<id>bfc4fab8943a28d2f30084a38d88678d7bfbbac4</id>
<content type='text'>
Refs #6884
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refs #6884
</pre>
</div>
</content>
</entry>
<entry>
<title>TomTom::Matrix: Handle error responses from TomTom</title>
<updated>2018-05-02T15:20:11+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-04-30T16:33:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=b6c0477552576e7f8575bf2dca6e7899b640c012'/>
<id>b6c0477552576e7f8575bf2dca6e7899b640c012</id>
<content type='text'>
Occasionally, the following error would appear in our logs:

    NoMethodError
    RouteWayCostWorker/perform

    Error message
    NoMethodError: undefined method `each_with_index' for nil:NilClass

    Stack trace (show Rails)
                                 /app/lib/tom_tom/matrix.rb:  83:in `extract_costs_to_way_costs!'
                                 /app/lib/tom_tom/matrix.rb:  23:in `matrix'
                                        /app/lib/tom_tom.rb:  24:in `matrix'
             /app/app/services/route_way_cost_calculator.rb:   8:in `calculate!'
                  /app/app/workers/route_way_cost_worker.rb:  12:in `perform'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 167:in `execute_job'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 139:in `block (5 levels) in process'
     /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb:  36:in `block in &lt;module:Sidekiq&gt;'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 135:in `block (4 levels) in process'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 128:in `block in invoke'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …-4.2.10/lib/sidekiq/middleware/server/active_record.rb:   6:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …idekiq-4.2.10/lib/sidekiq/middleware/server/logging.rb:  10:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …kiq-4.2.10/lib/sidekiq/middleware/server/retry_jobs.rb:  74:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 133:in `invoke'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 134:in `block (3 levels) in process'
    …/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/logging.rb:  32:in `with_context'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 132:in `block (2 levels) in process'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 183:in `stats'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 131:in `block in process'
     /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb:  35:in `block in &lt;module:Sidekiq&gt;'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 126:in `process'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb:  82:in `process_one'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb:  70:in `run'
    …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb:  17:in `watchdog'
    …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb:  26:in `block in safe_thread'

My best guess is that this was caused by TomTom responding with an
error, which we weren't handling previously. In that case, the response
would be a JSON string, but include an `'error'` field instead of
`'matrix'` and `'summary'`. Thus, when we'd try to
`matrix_json['matrix']`, it would fail.

Add a new method that checks for errors before we try to parse
`WayCost`s. If a server error is detected, we log the message to the
Rails log and return an empty array.

Refs #6884
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Occasionally, the following error would appear in our logs:

    NoMethodError
    RouteWayCostWorker/perform

    Error message
    NoMethodError: undefined method `each_with_index' for nil:NilClass

    Stack trace (show Rails)
                                 /app/lib/tom_tom/matrix.rb:  83:in `extract_costs_to_way_costs!'
                                 /app/lib/tom_tom/matrix.rb:  23:in `matrix'
                                        /app/lib/tom_tom.rb:  24:in `matrix'
             /app/app/services/route_way_cost_calculator.rb:   8:in `calculate!'
                  /app/app/workers/route_way_cost_worker.rb:  12:in `perform'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 167:in `execute_job'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 139:in `block (5 levels) in process'
     /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb:  36:in `block in &lt;module:Sidekiq&gt;'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 135:in `block (4 levels) in process'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 128:in `block in invoke'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …-4.2.10/lib/sidekiq/middleware/server/active_record.rb:   6:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …idekiq-4.2.10/lib/sidekiq/middleware/server/logging.rb:  10:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    …kiq-4.2.10/lib/sidekiq/middleware/server/retry_jobs.rb:  74:in `call'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 130:in `block in invoke'
    ….0/gems/sidekiq-4.2.10/lib/sidekiq/middleware/chain.rb: 133:in `invoke'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 134:in `block (3 levels) in process'
    …/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/logging.rb:  32:in `with_context'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 132:in `block (2 levels) in process'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 183:in `stats'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 131:in `block in process'
     /var/lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq.rb:  35:in `block in &lt;module:Sidekiq&gt;'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb: 126:in `process'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb:  82:in `process_one'
    …ems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/processor.rb:  70:in `run'
    …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb:  17:in `watchdog'
    …lib/gems/2.3.0/gems/sidekiq-4.2.10/lib/sidekiq/util.rb:  26:in `block in safe_thread'

My best guess is that this was caused by TomTom responding with an
error, which we weren't handling previously. In that case, the response
would be a JSON string, but include an `'error'` field instead of
`'matrix'` and `'summary'`. Thus, when we'd try to
`matrix_json['matrix']`, it would fail.

Add a new method that checks for errors before we try to parse
`WayCost`s. If a server error is detected, we log the message to the
Rails log and return an empty array.

Refs #6884
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #438 from af83/6368-gtfs-import</title>
<updated>2018-04-10T15:30:55+00:00</updated>
<author>
<name>Luc Donnet</name>
</author>
<published>2018-04-10T15:30:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=537a5078657ead0b89aa5220c05dfbc01ae94dca'/>
<id>537a5078657ead0b89aa5220c05dfbc01ae94dca</id>
<content type='text'>
GTFS import (first step)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GTFS import (first step)</pre>
</div>
</content>
</entry>
<entry>
<title>RouteWayCostUnitConverter: Snap values between 0–1 to 1</title>
<updated>2018-04-05T13:37:42+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-04-05T13:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=bfb194c5294c583dbf0bc0bef78b67d64a3a4f4c'/>
<id>bfb194c5294c583dbf0bc0bef78b67d64a3a4f4c</id>
<content type='text'>
We use integer values for distance (kilometres) and time (minutes). If
the values aren't very big, like bus stops inside a city for example,
the integer conversion will put distance and time at `0`, which isn't
correct.

To continue to use our chosen measurement units while still displaying
something that makes sense to users, snap any values &gt;0 and &lt;=1 to `1`.

Refs #6404
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We use integer values for distance (kilometres) and time (minutes). If
the values aren't very big, like bus stops inside a city for example,
the integer conversion will put distance and time at `0`, which isn't
correct.

To continue to use our chosen measurement units while still displaying
something that makes sense to users, snap any values &gt;0 and &lt;=1 to `1`.

Refs #6404
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #413 from af83/6222-route-way-costs--use-TomTom-matrix-API-instead-of-batch</title>
<updated>2018-04-04T08:03:40+00:00</updated>
<author>
<name>Alban Peignier</name>
</author>
<published>2018-04-04T08:03:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=ecf0dd6406576f8a63ee056fab73b05171c3e767'/>
<id>ecf0dd6406576f8a63ee056fab73b05171c3e767</id>
<content type='text'>
Route way costs  use tom tom matrix api instead of batch. Refs #6222</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Route way costs  use tom tom matrix api instead of batch. Refs #6222</pre>
</div>
</content>
</entry>
</feed>
