Commit 1aa48652e63b9fc1a29002ede8df2a1906b2d7bc
1 parent
8c9ea49d
Exists in
master
adding more data in csv
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
lib/juventude_plugin/people_job.rb
| ... | ... | @@ -15,21 +15,22 @@ class JuventudePlugin::PeopleJob < JuventudePlugin::ReportJob |
| 15 | 15 | people = Person.all |
| 16 | 16 | filepath = "/tmp/#{report_path}/people.csv" |
| 17 | 17 | CSV.open(filepath, 'w', {:col_sep => ';', :force_quotes => true} ) do |csv| |
| 18 | - csv << ['Identificador', 'Nome', 'Email', 'Orientação Sexual', 'Identidade de Gênero', 'Transgenero', 'Raça', 'Estado', 'Cidade'] | |
| 18 | + csv << ['Identificador','Criado em','Nome', 'Email', 'Orientação Sexual', 'Identidade de Gênero', 'Transgenero', 'Raça', 'Estado', 'Cidade'] | |
| 19 | 19 | count = 0 |
| 20 | 20 | people.map do |person| |
| 21 | 21 | count += 1 |
| 22 | 22 | puts "%s de %s: adicionando pessoa: %s" % [count, people.count, person.id ] |
| 23 | 23 | info = [] |
| 24 | 24 | info.push(person.identifier) |
| 25 | + info.push(person.created_at.strftime("%d/%m/%y %H:%M")) | |
| 25 | 26 | info.push(person.name) |
| 26 | 27 | info.push(person.email) |
| 27 | 28 | info.push(ORIENTACAO_SEXUAL[person.orientacao_sexual.to_i]) |
| 28 | 29 | info.push(GENERO[person.identidade_genero.to_i]) |
| 29 | 30 | info.push(person.transgenero) |
| 30 | 31 | info.push(ETNIA[person.etnia.to_i]) |
| 31 | - info.push(person.city ? person.city.name : '') | |
| 32 | - info.push(person.state ? person.state.name : '') | |
| 32 | + info.push(person.city) | |
| 33 | + info.push(person.state) | |
| 33 | 34 | csv << info |
| 34 | 35 | end |
| 35 | 36 | end | ... | ... |
lib/juventude_plugin/report_job.rb
| ... | ... | @@ -33,7 +33,7 @@ class JuventudePlugin::ReportJob < Struct.new(:profile_id, :report_path) |
| 33 | 33 | CSV.open(filepath, 'w', {:col_sep => ';', :force_quotes => true} ) do |csv| |
| 34 | 34 | proposals = ProposalsDiscussionPlugin::Proposal.all |
| 35 | 35 | count = 0 |
| 36 | - csv << ['Identificador','Criada em', 'Autor', 'Titulo', 'Proposta', 'Comentarios', 'Seguidores', 'Votos'] | |
| 36 | + csv << ['Identificador','Criada em', 'Autor', 'Eixo', 'Titulo', 'Proposta', 'Comentarios', 'Seguidores', 'Votos', 'Cidade'] | |
| 37 | 37 | proposals.map do |proposal| |
| 38 | 38 | count += 1 |
| 39 | 39 | puts "%s de %s: adicionando proposta: %s" % [count, proposals.count, proposal.id ] |
| ... | ... | @@ -41,11 +41,13 @@ class JuventudePlugin::ReportJob < Struct.new(:profile_id, :report_path) |
| 41 | 41 | info.push(proposal.id) |
| 42 | 42 | info.push(proposal.created_at.strftime("%d/%m/%y %H:%M")) |
| 43 | 43 | info.push(proposal.author ? proposal.author.identifier : '') |
| 44 | + info.push(proposal.topic.name) | |
| 44 | 45 | info.push(proposal.title) |
| 45 | 46 | info.push(proposal.abstract.present? ? proposal.abstract.gsub(/\s+/, ' ').strip : '') |
| 46 | 47 | info.push(proposal.comments_count) |
| 47 | 48 | info.push(proposal.followers.count) |
| 48 | 49 | info.push(proposal.votes_for) |
| 50 | + info.push(proposal.cities.map{|c|c.path}.join(',')) | |
| 49 | 51 | csv << info |
| 50 | 52 | end |
| 51 | 53 | end | ... | ... |