Commit ffd10633bc91000bd8656b62778c445b1d2a8ba1

Authored by Victor Costa
1 parent 9cf3e36c
Exists in master

Change order of report columns

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
lib/dialoga_plugin/report_job.rb
@@ -33,7 +33,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path) @@ -33,7 +33,7 @@ class DialogaPlugin::ReportJob < Struct.new(:profile_id, :report_path)
33 CSV.open(filepath, 'w', {:col_sep => ';'} ) do |csv| 33 CSV.open(filepath, 'w', {:col_sep => ';'} ) do |csv|
34 tasks = ProposalsDiscussionPlugin::ProposalTask.all 34 tasks = ProposalsDiscussionPlugin::ProposalTask.all
35 count = 0 35 count = 0
36 - csv << ['Tema', 'Origem', 'Status', 'Criada em', 'Moderado por', 'Data de Moderado', 'Validado por', 'Data de Validado', 'Autor', 'Proposta', 'Categorias'] 36 + csv << ['Origem', 'Status', 'Criada em', 'Moderado por', 'Data de Moderado', 'Validado por', 'Data de Validado', 'Autor', 'Proposta', 'Categorias', 'Tema']
37 status_translation = { 37 status_translation = {
38 1 => 'Pendente de Moderacao', 38 1 => 'Pendente de Moderacao',
39 2 => 'Rejeitada', 39 2 => 'Rejeitada',
@@ -45,7 +45,6 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path) @@ -45,7 +45,6 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path)
45 count += 1 45 count += 1
46 puts "%s de %s: adicionando task: %s" % [count, tasks.count, task.id ] 46 puts "%s de %s: adicionando task: %s" % [count, tasks.count, task.id ]
47 info = [] 47 info = []
48 - info.push(task.article_parent.nil? ? '' : task.article_parent.categories.map(&:name).join(' '))  
49 info.push(task.proposal_source) 48 info.push(task.proposal_source)
50 info.push(status_translation[task.status]) 49 info.push(status_translation[task.status])
51 info.push(task.created_at.strftime("%d/%m/%y %H:%M")) 50 info.push(task.created_at.strftime("%d/%m/%y %H:%M"))
@@ -56,6 +55,7 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path) @@ -56,6 +55,7 @@ class DialogaPlugin::ReportJob &lt; Struct.new(:profile_id, :report_path)
56 info.push(task.requestor.present? ? task.requestor.name : '') 55 info.push(task.requestor.present? ? task.requestor.name : '')
57 info.push(task.abstract.present? ? task.abstract.gsub(/\s+/, ' ').strip : '') 56 info.push(task.abstract.present? ? task.abstract.gsub(/\s+/, ' ').strip : '')
58 info.push(task.categories.map {|c| c.name}.join(' ')) 57 info.push(task.categories.map {|c| c.name}.join(' '))
  58 + info.push(task.article_parent.nil? ? '' : task.article_parent.categories.map(&:name).join(' '))
59 csv << info 59 csv << info
60 end 60 end
61 end 61 end