diff options
| author | Teddy Wing | 2017-08-25 11:24:52 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-08-25 11:24:52 +0200 |
| commit | 92484fa903dd7cbf4a40bf6b0b65ed79306c6ae9 (patch) | |
| tree | 8e1945036f719e0881dc78b5613ea2ca7ca121fa | |
| parent | 1930ccb023cffe9aa752a0f03a73124a70398b6c (diff) | |
| download | chouette-core-92484fa903dd7cbf4a40bf6b0b65ed79306c6ae9.tar.bz2 | |
ReferentialMetadataKludge: Get line IDs by `objectid`
Instead of hard-coding an ID for the line IDs, get them by their
`objectid` field.
Worked on this with Alban.
Even though the Kludge class is for testing purposes only and isn't
meant to be real, let's take out the hard-coded values.
The `objectid`s correspond to those in the OFFRE_... zip in
`spec/fixtures/`.
| -rw-r--r-- | lib/referential_metadata_kludge.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/referential_metadata_kludge.rb b/lib/referential_metadata_kludge.rb index 525b471ad..fcebc5491 100644 --- a/lib/referential_metadata_kludge.rb +++ b/lib/referential_metadata_kludge.rb @@ -1,9 +1,15 @@ module ReferentialMetadataKludge extend self def make_metadata_from_name!( name, referential_id: ) + line_ids = Chouette::Line.where( + objectid: ['C00108', 'C00109'].map do |id| + "STIF:CODIFLIGNE:Line:#{id}" + end + ).pluck(:id) + ReferentialMetadata.create!( referential_id: referential_id, - line_ids: [107, 108], + line_ids: line_ids, periodes: name_to_periods(name)) end |
