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

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