From 5a6efc44dd862384b80f6ff48583e9f9229dbaf4 Mon Sep 17 00:00:00 2001 From: Xinhui Date: Thu, 29 Sep 2016 17:58:03 +0200 Subject: Launch reflex:sync from interface Refs #1712 --- lib/tasks/codifligne.rake | 3 +-- lib/tasks/reflex.rake | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/tasks') diff --git a/lib/tasks/codifligne.rake b/lib/tasks/codifligne.rake index 4a108f789..dd5e99370 100644 --- a/lib/tasks/codifligne.rake +++ b/lib/tasks/codifligne.rake @@ -1,8 +1,7 @@ namespace :codifligne do desc "Sync lines, companies, networks, and group of lines from codifligne" task sync: :environment do - lref = LineReferential.find_by(name: 'CodifLigne') - sync = lref.line_referential_syncs.build + sync = LineReferential.find_by(name: 'CodifLigne').line_referential_syncs.build raise "Codifligne:sync aborted - There is already an synchronisation in progress" unless sync.valid? sync.save if sync.valid? end diff --git a/lib/tasks/reflex.rake b/lib/tasks/reflex.rake index 0020f1b60..67496cee0 100644 --- a/lib/tasks/reflex.rake +++ b/lib/tasks/reflex.rake @@ -1,8 +1,8 @@ namespace :reflex do desc "Sync data from Reflex api" task sync: :environment do - start = Time.now - Stif::ReflexSynchronization.synchronize - Rails.logger.debug "Reflex:sync done in #{Time.now - start} seconds !" + sync = StopAreaReferential.find_by(name: 'Reflex').stop_area_referential_syncs.build + raise "reflex:sync aborted - There is already an synchronisation in progress" unless sync.valid? + sync.save if sync.valid? end end -- cgit v1.2.3