summaryrefslogtreecommitdiff
path: root/app/services/tartiflette_score_export_service.rb
blob: 26334a0ce0378e98433184c876fcf5a6ed624d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "csv"

class TartifletteScoreExportService
  def self.generate_csv
    CSV.generate(headers: true) do |csv|
      csv << [ "Identifiant", "Critère", "Score", "Création" ]
      Tartiflette.all.each do |tartiflette|
        tartiflette.scores.each do |score|
          csv << [
            tartiflette.scoring_id,
            score.scoring_criterium.name,
            score.value,
            score.created_at
          ]
        end
      end
    end
  end
end
Copyright 2019--2025 Marius PETER