1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-02 13:24:20 +01:00
fab-manager/app/views/api/statistics/export_subscription.xlsx.axlsx
2016-07-06 19:00:22 +02:00

13 lines
692 B
Plaintext

wb = xlsx_package.workbook
price = wb.styles.add_style :format_code => ''
wb.add_worksheet(name: "Abonnements") do |sheet|
sheet.add_row ['Entrées', @results['hits']['total']]
sheet.add_row ["Chiffre d'affaires", @results['aggregations']['total_ca']['value']]
sheet.add_row ['Âge moyen', @results['aggregations']['average_age']['value']]
sheet.add_row ['Date', 'ID Utilisateur', 'Genre', 'Âge', 'Type', 'Groupe', "Chiffre d'affaire"]
@results['hits']['hits'].each do |hit|
sheet.add_row [hit['_source']['date'], hit['_source']['userId'], hit['_source']['gender'], hit['_source']['age'], hit['_source']['planId'], hit['_source']['groupName'], hit['_source']['ca']]
end
end