aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/codifligne.rake8
-rw-r--r--lib/tasks/compliance_check_sets.rb11
-rw-r--r--lib/tasks/exports.rake14
-rw-r--r--lib/tasks/imports.rake10
-rw-r--r--lib/tasks/organisations.rake6
-rw-r--r--lib/tasks/reflex.rake8
-rw-r--r--lib/tasks/users.rake6
7 files changed, 7 insertions, 56 deletions
diff --git a/lib/tasks/codifligne.rake b/lib/tasks/codifligne.rake
deleted file mode 100644
index dd5e99370..000000000
--- a/lib/tasks/codifligne.rake
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace :codifligne do
- desc "Sync lines, companies, networks, and group of lines from codifligne"
- task sync: :environment do
- 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
-end
diff --git a/lib/tasks/compliance_check_sets.rb b/lib/tasks/compliance_check_sets.rb
deleted file mode 100644
index c53c7f9ed..000000000
--- a/lib/tasks/compliance_check_sets.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace :compliance_check_sets do
- desc "Notify parent check sets when children finish"
- task notify_parent: :environment do
- ParentNotifier.new(ComplianceCheckSet).notify_when_finished
- end
-
- desc "Mark old unfinished check sets as 'aborted'"
- task abort_old: :environment do
- ComplianceCheckSet.abort_old
- end
-end
diff --git a/lib/tasks/exports.rake b/lib/tasks/exports.rake
index 845d581d3..33fbf81ed 100644
--- a/lib/tasks/exports.rake
+++ b/lib/tasks/exports.rake
@@ -52,9 +52,9 @@ namespace :export do
puts "No maching journeys were found".red
else
exports_group = SimpleInterfacesGroup.new "Export Complet \"#{referential.name}\" du #{Time.now.to_date} au #{args[:timelapse].to_i.days.from_now.to_date}"
- exports_group.shared_options = {verbose: true}
+ exports_group.shared_options = {verbose: true, output_dir: args[:output_dir]}
- exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_companies", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_companies.json"
+ exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_companies", filepath: "#{args[:output_dir]}/service_type.json"
ids = journeys.pluck :company_id
ids += journeys.joins(route: :line).pluck :"lines.company_id"
@@ -64,28 +64,28 @@ namespace :export do
exports_group.add_interface exporter, "Services Types", :export
- exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_schedules", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_schedules.json"
+ exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_schedules", filepath: "#{args[:output_dir]}/schedule.json"
exporter.configure do |config|
- config.collection = journeys
+ config.collection = journeys.where("custom_field_values->>'capacity' IS NOT NULL")
end
exports_group.add_interface exporter, "Schedules", :export
- exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_routes", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_routes.json"
+ exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_routes", filepath: "#{args[:output_dir]}/route.json"
exporter.configure do |config|
config.collection = Chouette::JourneyPattern.where(id: journeys.pluck(:journey_pattern_id).uniq)
end
exports_group.add_interface exporter, "Routes", :export
- exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_stops", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_stops.json"
+ exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_stops", filepath: "#{args[:output_dir]}/station.json"
exporter.configure do |config|
config.collection = Chouette::StopArea.where(id: journeys.joins(:stop_points).pluck(:"stop_points.stop_area_id").uniq).order('parent_id ASC NULLS FIRST')
end
exports_group.add_interface exporter, "Stops", :export
- exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_journeys", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_journeys.json"
+ exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_journeys", filepath: "#{args[:output_dir]}/service.json"
exporter.configure do |config|
config.collection = journeys
end
diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake
index d393ab156..258c37bbd 100644
--- a/lib/tasks/imports.rake
+++ b/lib/tasks/imports.rake
@@ -2,16 +2,6 @@ require 'csv'
require 'tasks/helpers/simple_interfaces'
namespace :import do
- desc "Notify parent imports when children finish"
- task notify_parent: :environment do
- ParentNotifier.new(Import::Base).notify_when_finished
- end
-
- desc "Mark old unfinished Netex imports as 'aborted'"
- task netex_abort_old: :environment do
- Import::Netex.abort_old
- end
-
desc "import the given file with the corresponding importer"
task :import, [:configuration_name, :filepath, :referential_id, :logs_output_dir] => :environment do |t, args|
args.with_defaults(logs_output_dir: "./log/importers/")
diff --git a/lib/tasks/organisations.rake b/lib/tasks/organisations.rake
deleted file mode 100644
index 1b21d7119..000000000
--- a/lib/tasks/organisations.rake
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace :organisations do
- desc "Sync organisations from stif portail"
- task sync: :environment do
- Organisation.portail_sync
- end
-end
diff --git a/lib/tasks/reflex.rake b/lib/tasks/reflex.rake
deleted file mode 100644
index 67496cee0..000000000
--- a/lib/tasks/reflex.rake
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace :reflex do
- desc "Sync data from Reflex api"
- task sync: :environment do
- 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
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake
deleted file mode 100644
index c045639c1..000000000
--- a/lib/tasks/users.rake
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace :users do
- desc "Sync users from stif portail"
- task sync: :environment do
- User.portail_sync
- end
-end