diff --git a/plugins/dialoga b/plugins/dialoga index f15d572..14cab19 160000 --- a/plugins/dialoga +++ b/plugins/dialoga @@ -1 +1 @@ -Subproject commit f15d572167ea9402a41a351288217319307ca129 +Subproject commit 14cab1934b678869e16e9e0943d0e7a93baaba21 diff --git a/script/sent_event_report b/script/sent_event_report deleted file mode 100755 index c325e8f..0000000 --- a/script/sent_event_report +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/environment' -require 'net/smtp' - -puts 'Iniciando script' - -file = File.open(File.join(Rails.root,'event.csv'), 'w+') - -events = Event.all -events.map do |event| - file.write(event.name+ "\n") - header = "'Nome';'Email'\n" - file.write(header) - count = 0 - event.person_followers.map do |person| - count += 1 - puts "%s de %s: adicionando evento: %s" % [count, event.person_followers.count, event.id ] - info = [] - info.push(person.name) - info.push(person.email) - file.write(info.map{|i| "'" + i.to_s + "'"}.join(";")) - file.write("\n") - end -end - -file.close - diff --git a/script/sent_proposal_report b/script/sent_proposal_report deleted file mode 100755 index bf95bac..0000000 --- a/script/sent_proposal_report +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/environment' -require 'net/smtp' - - -emails = ['leandronunes@gmail.com', 'leandro.santos@serpro.gov.br'] + ARGV -emails.uniq! - -puts 'Iniciando script' - -file = File.open(File.join(Rails.root,'data.csv'), 'w+') - -tasks = ProposalsDiscussionPlugin::ProposalTask.all -count = 0 -header = "'Origem';'Status';'Criada em';'Moderado por';'Data de Moderado';'Validado por';'Data de Validado';'Autor';'Proposta'\n" -file.write(header) -STATUS_TRANSLATION = { - 1 => 'Pendente de Moderacao', - 2 => 'Rejeitada', - 3 => 'Aprovada', - 5 => 'Pre Aprovada', - 6 => 'Pre Rejeitada', -} -tasks.map do |task| - count += 1 - puts "%s de %s: adicionando task: %s" % [count, tasks.count, task.id ] - info = [] - info.push(task.proposal_source) - info.push(STATUS_TRANSLATION[task.status]) - info.push(task.created_at.strftime("%d/%m/%y %H:%M")) - info.push(task.proposal_evaluation.present? ? task.proposal_evaluation.evaluated_by.name : '') - info.push(task.proposal_evaluation.present? ? task.proposal_evaluation.created_at.strftime("%d/%m/%y %H:%M") : '') - info.push(task.closed_by.present? ? task.closed_by.name : '') - info.push(task.closed_by.present? ? task.end_date.strftime("%d/%m/%y %H:%M") : '') - info.push(task.requestor.present? ? task.requestor.name : '') - info.push(task.abstract.present? ? task.abstract.gsub(/\s+/, ' ').strip : '') - file.write(info.map{|i| "'" + i.to_s + "'"}.join(";")) - file.write("\n") -end - -file.close - -ActionMailer::Base.logger = Logger.new(STDOUT) -class Sender < ActionMailer::Base - def send_report(to, from) - attachments["eventos.csv"] = File.read("#{Rails.root}/event.csv") - attachments["propostas.csv"] = File.read("#{Rails.root}/data.csv") - mail to: to, from: from, - subject: "Relatorio do Dialoga", body: "Segue em anexo os relatorios do Dialoga" - end - -end - -Sender.send_report(emails, 'dialoga@dialoga.gov.br').deliver -- libgit2 0.21.2