diff options
| author | Alban Peignier | 2015-06-11 12:30:03 +0200 |
|---|---|---|
| committer | Alban Peignier | 2015-06-15 15:00:15 +0200 |
| commit | 275b1893722ec09bc04033344865bea399eb9ca3 (patch) | |
| tree | 22763c9adf4e7acead7e5f63f3b1f972701f0200 | |
| parent | 26526fe0127cbc8be164a63c8350e9555e338305 (diff) | |
| download | chouette-core-275b1893722ec09bc04033344865bea399eb9ca3.tar.bz2 | |
Remove two puts
| -rw-r--r-- | app/models/export_task.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/app/models/export_task.rb b/app/models/export_task.rb index 3dbda0a70..59a2103aa 100644 --- a/app/models/export_task.rb +++ b/app/models/export_task.rb @@ -12,7 +12,7 @@ class ExportTask enumerize :data_format, in: %w( neptune netex gtfs hub kml ) attr_accessor :referential_id, :user_id, :user_name, :references_type, :data_format, :name, :projection_type, :reference_ids - + validates_presence_of :referential_id validates_presence_of :user_id validates_presence_of :user_name @@ -22,16 +22,16 @@ class ExportTask validate :period_validation after_initialize :init_period - + def initialize( params = {} ) run_callbacks :initialize do params.each {|k,v| send("#{k}=",v)} end end - + def period_validation - st_date = Date.parse(start_date) unless start_date.blank? - ed_date = Date.parse(end_date) unless end_date.blank? + st_date = Date.parse(start_date) unless start_date.blank? + ed_date = Date.parse(end_date) unless end_date.blank? unless Chouette::TimeTable.start_validity_period.nil? || st_date.nil? tt_st_date = Chouette::TimeTable.start_validity_period errors.add(:start_date, ExportTask.human_attribute_name("start_date_greater_than" , {:tt_st_date => tt_st_date})) unless tt_st_date <= st_date @@ -44,7 +44,7 @@ class ExportTask errors.add(:end_date, ExportTask.human_attribute_name("end_date_less_than", {:tt_ed_date => tt_ed_date})) unless ed_date <= tt_ed_date end end - + def init_period unless Chouette::TimeTable.start_validity_period.nil? if start_date.nil? @@ -65,14 +65,12 @@ class ExportTask end def save - puts self.errors.inspect - puts self.errors.size if self.valid? # Call Iev Server - begin + begin Ievkit.create_job( referential.slug, "exporter", data_format, { :file1 => params_io, - } ) + } ) rescue Exception => exception raise exception end @@ -95,11 +93,11 @@ class ExportTask h["parameters"] = action_params end end - + def action_params {} end - + def params_io file = StringIO.new( params.to_json ) Faraday::UploadIO.new(file, "application/json", "parameters.json") |
