parent
589c0f7e11
commit
a538eb72f2
@ -1,29 +1,31 @@
|
||||
require 'net/sftp'
|
||||
require 'uri'
|
||||
require 'csv'
|
||||
require "net/sftp"
|
||||
require "uri"
|
||||
require "csv"
|
||||
|
||||
module Sftp
|
||||
class Directory
|
||||
def self.open(path: '/data/survey_responses/clean', &block)
|
||||
sftptogo_url = ENV['MCIEA_SFTPTOGO_URL']
|
||||
uri = URI.parse(sftptogo_url)
|
||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
||||
sftp.dir.foreach(path) do |entry|
|
||||
next unless entry.file?
|
||||
module Dashboard
|
||||
module Sftp
|
||||
class Directory
|
||||
def self.open(path: "/data/survey_responses/clean", &block)
|
||||
sftptogo_url = ENV["ECP_SFTPTOGO_URL"]
|
||||
uri = URI.parse(sftptogo_url)
|
||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
||||
sftp.dir.foreach(path) do |entry|
|
||||
next unless entry.file?
|
||||
|
||||
filename = entry.name
|
||||
puts filename
|
||||
filename = entry.name
|
||||
puts filename
|
||||
|
||||
sftp.file.open(filepath(path:, filename:), 'r', &block)
|
||||
sftp.file.open(filepath(path:, filename:), "r", &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.filepath(path:, filename:)
|
||||
path += '/' unless path.end_with?('/')
|
||||
"#{path}#{filename}"
|
||||
end
|
||||
def self.filepath(path:, filename:)
|
||||
path += "/" unless path.end_with?("/")
|
||||
"#{path}#{filename}"
|
||||
end
|
||||
|
||||
private_class_method :filepath
|
||||
private_class_method :filepath
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,33 +1,35 @@
|
||||
require 'net/sftp'
|
||||
require 'uri'
|
||||
require 'csv'
|
||||
require "net/sftp"
|
||||
require "uri"
|
||||
require "csv"
|
||||
|
||||
module Sftp
|
||||
class RaceLoader
|
||||
def self.load_data(path: '/data/survey_responses/')
|
||||
SurveyItemResponse.update_all(student_id: nil)
|
||||
StudentRace.delete_all
|
||||
Student.delete_all
|
||||
module Dashboard
|
||||
module Sftp
|
||||
class RaceLoader
|
||||
def self.load_data(path: "/data/survey_responses/")
|
||||
SurveyItemResponse.update_all(student_id: nil)
|
||||
StudentRace.delete_all
|
||||
Student.delete_all
|
||||
|
||||
sftptogo_url = ENV['SFTPTOGO_URL']
|
||||
uri = URI.parse(sftptogo_url)
|
||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
||||
sftp.dir.foreach(path) do |entry|
|
||||
filename = entry.name
|
||||
puts filename
|
||||
sftptogo_url = ENV["SFTPTOGO_URL"]
|
||||
uri = URI.parse(sftptogo_url)
|
||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
||||
sftp.dir.foreach(path) do |entry|
|
||||
filename = entry.name
|
||||
puts filename
|
||||
|
||||
sftp.file.open(filepath(path:, filename:), 'r') do |f|
|
||||
StudentLoader.from_file(file: f, rules: [Rule::SkipNonLowellSchools])
|
||||
sftp.file.open(filepath(path:, filename:), "r") do |f|
|
||||
StudentLoader.from_file(file: f, rules: [Rule::SkipNonLowellSchools])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.filepath(path:, filename:)
|
||||
path += '/' unless path.end_with?('/')
|
||||
"#{path}#{filename}"
|
||||
end
|
||||
def self.filepath(path:, filename:)
|
||||
path += "/" unless path.end_with?("/")
|
||||
"#{path}#{filename}"
|
||||
end
|
||||
|
||||
private_class_method :filepath
|
||||
private_class_method :filepath
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -0,0 +1 @@
|
||||
w0UoY2qMIqo1VCeX8KqsreT2AVVYCfzD4Eh0NVjDnrC+MTHRCto6QnYzzI7R43hle5WeChXFC3MNisW1LYQTmqnfGV6YPk1bYkyzrRo1DA0ObbizYiGnHFPIuTl0PUBxM4dM/dbrHIVa6dJPlupfhsMFKAhITtLZd/cKg6vQsQk32Hdpis4sOSkUqTBC0DcIS4oCjqBW7KOTPft1DyDPFobz9laKoVgWW9sLXwJ3ETQ5VpFjIovTp4/p11GB1CZCbcyw0JnKIzr45RUd//ZIuxAenOcodhABNqmfPMR9Uqyi+keYFc99oA+i7WjOiBd9ZpEtfYdO/voso7A9oxO/BTwOnt+KMCVlPNF6e7G1oWJQhsR8ZWWOYrYGeuIbSaOuNesAgGk6hupSjTyo2h0hGLEF9BznOf5EP86HrnB3L5041wbtyNbB2ers6F/z6xozKi9c2ULdQl93QUoJ/7BB/Lz0G1p+oedp5IIdLmHjS+oGquEf/OdkZdKIqiGFOEAGwTPc98ZJWncI3jW5UYxLJDcoOz9HIiaJX6b+yHKrjv0p79t1f1v3er6J6Hk8TafdO7+sjMcEMZOY5NnAmQumB1s3DXDxYU0588wrk2C2f+G0COTrevznFO8emQHpPuct6nHMuALfNegDCwAPYi4=--bpaVQ6fuv5gN3jZU--8DcQfciEdVpnAQjmtCvQ3g==
|
||||
@ -0,0 +1 @@
|
||||
509ee7d28bf17b106698d4efc62fa139
|
||||
Loading…
Reference in new issue