From 354ff1a593b7518676eed1761687052d37ffab7d Mon Sep 17 00:00:00 2001 From: Alon Salant Date: Mon, 31 Mar 2014 22:42:32 -0700 Subject: [PATCH] Add person_id to visits CSV report --- app/models/visit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/visit.rb b/app/models/visit.rb index 6376a279..974ac006 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -52,11 +52,11 @@ def initialize(params={}) :self => %w{arrived_at staff member volunteer note} } def self.csv_header - CSV.generate_line(CSV_FIELDS[:person] + CSV_FIELDS[:self]) + CSV.generate_line(['person_id'] + CSV_FIELDS[:person] + CSV_FIELDS[:self]) end def to_csv - values = person.attributes.values_at(*CSV_FIELDS[:person]) + values = [person.id].concat person.attributes.values_at(*CSV_FIELDS[:person]) values << (arrived_at.nil? ? nil : arrived_at.strftime("%Y-%m-%d %H:%M")) values << staff? values << member?