diff options
| author | Xinhui | 2016-09-29 17:58:03 +0200 | 
|---|---|---|
| committer | Xinhui | 2016-09-29 17:58:03 +0200 | 
| commit | 5a6efc44dd862384b80f6ff48583e9f9229dbaf4 (patch) | |
| tree | 2375722be0855f5e43e1d09481ef68fea21d0cb4 /lib/tasks | |
| parent | a1fffa57564825303671c20e596f4fc944fbdd12 (diff) | |
| download | chouette-core-5a6efc44dd862384b80f6ff48583e9f9229dbaf4.tar.bz2 | |
Launch reflex:sync from interface
Refs #1712
Diffstat (limited to 'lib/tasks')
| -rw-r--r-- | lib/tasks/codifligne.rake | 3 | ||||
| -rw-r--r-- | lib/tasks/reflex.rake | 6 | 
2 files changed, 4 insertions, 5 deletions
| 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 | 
