Sha256: ec6881174806b2960141c6405023fa1a22fc9ec20ece4a40251a3eead9710208
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
#encoding: utf-8 agendamentos_import = JSON.parse(open("#{Rails.root}/db/seeds/agendamentos.json").read) pacientes = Paciente.all agendamentos_import['VEVENT'].each do |a| if (DateTime.parse(a['DTSTART']).strftime('%H:%M:%S') >= "12:00:00") pacientes.each do |p| a['SUMMARY'].gsub!(/\//,'') a['SUMMARY'].scan(/([^0-9]+)([0-9]+)/) { |nome, numero| if ( (((!nome.nil? && !p.nome.nil?) && (nome != "" && p.nome != "")) && (nome.downcase.gsub(/[^a-z]/, '') == p.nome.downcase.gsub(/[^a-z]/, ''))) || (((!numero.nil? && !p.registro.nil?) && (numero != "" && p.registro != "")) && (numero.gsub(/\D/, '') == p.registro.gsub(/\D/, ''))) || (((!numero.nil? && !p.telefone.nil?) && (numero != "" && p.telefone != "")) && (numero.gsub(/\D/, '') == p.telefone.gsub(/\D/, ''))) || (((!numero.nil? && !p.celular.nil?) && (numero != "" && p.celular != "")) && (numero.gsub(/\D/, '') == p.celular.gsub(/\D/, ''))) ) agendamento = Agendamento.find_by_paciente_id(p.id) puts agendamento if !agendamento.nil? && agendamento.data == a['DTSTART'].to_date print agendamento.data print a['DTSTART'].to_time agendamento.update_attributes!(turno_id: 2) end end } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-sabia-1.0.1 | db/seeds/correcao_horario.rb |