From 64e708a7c9eb3998b7f0f54e77195966b74dda66 Mon Sep 17 00:00:00 2001 From: Xinhui Date: Fri, 14 Oct 2016 11:13:33 +0200 Subject: Refactoring line operator ref Refs #1810 --- Gemfile.lock | 2 +- lib/stif/codif_line_synchronization.rb | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index adf7c7999..cda2bdf70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GIT GIT remote: git@github.com:AF83/stif-codifline-api.git - revision: aee8bb5320bf03369fe15fd2f000b55e12c8b915 + revision: 72d53d7666736523b5cbef41a2de7e466d58ea1a specs: codifligne (0.0.2) nokogiri (~> 1.6) diff --git a/lib/stif/codif_line_synchronization.rb b/lib/stif/codif_line_synchronization.rb index 1be5474c2..d580ae3b8 100644 --- a/lib/stif/codif_line_synchronization.rb +++ b/lib/stif/codif_line_synchronization.rb @@ -71,13 +71,9 @@ module Stif import_xml: api_line.xml } - # Find Company - # TODO Check behavior when operator_codes count is 0 or > 1 - if api_line.operator_codes.any? - company_id = "STIF:CODIFLIGNE:Operator:" + api_line.operator_codes.first - params[:company] = Chouette::Company.find_by(objectid: company_id) + unless api_line.operator_ref.nil? + params[:company] = Chouette::Company.find_by(objectid: api_line.operator_ref) end - save_or_update(params, Chouette::Line) end -- cgit v1.2.3