From 653de014d0ed5698e5a54ec1104b037c578126d8 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 18 Jul 2022 10:53:34 +0100 Subject: [PATCH] add unittype_sh column to csv export --- app/models/case_log.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index a8250056d..ef77ea5a5 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -411,10 +411,10 @@ class CaseLog < ApplicationRecord def self.to_csv CSV.generate(headers: true) do |csv| - csv << attribute_names + csv << attribute_names + %w[unittype_sh] all.find_each do |record| - csv << record.attributes.map do |att, val| + csv << record.attributes.merge({ "unittype_sh" => record.unittype_sh }).map do |att, val| record.form.get_question(att, record)&.label_from_value(val) || val end end