Commit 7629bc229b0fcc6049871c0a4108c0cde0209c63

Authored by Victor Costa
1 parent b963a3fc
Exists in master

Add fileds to reports

lib/dialoga_plugin/ranking_job.rb
... ... @@ -18,8 +18,8 @@ class DialogaPlugin::RankingJob < DialogaPlugin::ReportJob
18 18  
19 19 filepath = "/tmp/#{report_path}/ranking-#{discussion.slug}_#{article.slug}.csv"
20 20 CSV.open(filepath, 'w', {:col_sep => ';', :force_quotes => true}) do |csv|
21   - csv << ['Posição', 'Id', 'Proposta', 'Positivo', 'Negativo', 'Exibições', 'Valor']
22   - ranking.each_with_index {|r, i| csv << [r.position, r.id, r.abstract, r.votes_for, r.votes_against, r.hits, r.effective_support].flatten}
  21 + csv << ['Posição', 'Id', 'Proposta', 'Positivo', 'Negativo', 'Exibições', 'Valor', 'Autor', 'Email do Autor']
  22 + ranking.each_with_index {|r, i| csv << [r.position, r.id, r.abstract, r.votes_for, r.votes_against, r.hits, r.effective_support, r.proposal.created_by.present? ? r.proposal.created_by.name : r.proposal.author_name, r.proposal.created_by.present? ? r.proposal.created_by.email : ''].flatten}
23 23 end
24 24 end
25 25 end
... ...
lib/dialoga_plugin/report_job.rb
... ... @@ -33,7 +33,7 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path)
33 33 CSV.open(filepath, 'w', {:col_sep => ';', :force_quotes => true} ) do |csv|
34 34 tasks = ProposalsDiscussionPlugin::ProposalTask.all
35 35 count = 0
36   - csv << ['Origem', 'Status', 'Criada em', 'Moderado por', 'Data de Moderado', 'Validado por', 'Data de Validado', 'Autor', 'Proposta', 'Categorias', 'Tema']
  36 + csv << ['Origem', 'Status', 'Criada em', 'Moderado por', 'Data de Moderado', 'Validado por', 'Data de Validado', 'Autor', 'Proposta', 'Categorias', 'Tema', 'Email do Autor']
37 37 status_translation = {
38 38 1 => 'Pendente de Moderacao',
39 39 2 => 'Rejeitada',
... ... @@ -56,6 +56,7 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path)
56 56 info.push(task.abstract.present? ? task.abstract.gsub(/\s+/, ' ').strip : '')
57 57 info.push(task.categories.map {|c| c.name}.join(' '))
58 58 info.push(task.article_parent.nil? ? '' : task.article_parent.categories.map(&:name).join(' '))
  59 + info.push(task.requestor.present? ? task.requestor.email : '')
59 60 csv << info
60 61 end
61 62 end
... ...