Commit e54ae84a24b6321131a3370c34d558b85b2f18e7

Authored by Luke Baker
1 parent 46d9dadd

CSV: remove appearance id from votes and non-votes

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
app/models/question.rb
... ... @@ -512,14 +512,14 @@ class Question < ActiveRecord::Base
512 512 when 'votes'
513 513 outfile = "ideamarketplace_#{self.id}_votes.csv"
514 514  
515   - headers = ['Vote ID', 'Session ID', 'Question ID','Winner ID', 'Winner Text', 'Loser ID', 'Loser Text', 'Prompt ID', 'Left Choice ID', 'Right Choice ID', 'Created at', 'Updated at', 'Appearance ID', 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier', 'Valid']
  515 + headers = ['Vote ID', 'Session ID', 'Question ID','Winner ID', 'Winner Text', 'Loser ID', 'Loser Text', 'Prompt ID', 'Left Choice ID', 'Right Choice ID', 'Created at', 'Updated at', 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier', 'Valid']
516 516  
517 517 when 'ideas'
518 518 outfile = "ideamarketplace_#{self.id}_ideas.csv"
519 519 headers = ['Ideamarketplace ID','Idea ID', 'Idea Text', 'Wins', 'Losses', 'Times involved in Cant Decide', 'Score', 'User Submitted', 'Session ID', 'Created at', 'Last Activity', 'Active', 'Appearances on Left', 'Appearances on Right']
520 520 when 'non_votes'
521 521 outfile = "ideamarketplace_#{self.id}_non_votes.csv"
522   - headers = ['Record Type', 'Record ID', 'Session ID', 'Question ID','Left Choice ID', 'Left Choice Text', 'Right Choice ID', 'Right Choice Text', 'Prompt ID', 'Appearance ID', 'Reason', 'Created at', 'Updated at', 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier', 'Valid']
  522 + headers = ['Record Type', 'Record ID', 'Session ID', 'Question ID','Left Choice ID', 'Left Choice Text', 'Right Choice ID', 'Right Choice Text', 'Prompt ID', 'Reason', 'Created at', 'Updated at', 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier', 'Valid']
523 523 else
524 524 raise "Unsupported export type: #{type}"
525 525 end
... ... @@ -543,7 +543,7 @@ class Question < ActiveRecord::Base
543 543 time_viewed = v.time_viewed.nil? ? "NA": v.time_viewed.to_f / 1000.0
544 544  
545 545 csv << [ v.id, v.voter_id, v.question_id, v.choice_id, v.choice.data.strip, v.loser_choice_id, loser_data,
546   - v.prompt_id, left_id, right_id, v.created_at, v.updated_at, v.appearance_id,
  546 + v.prompt_id, left_id, right_id, v.created_at, v.updated_at,
547 547 time_viewed, v.missing_response_time_exp , v.voter.identifier, valid]
548 548 end
549 549  
... ... @@ -574,12 +574,12 @@ class Question &lt; ActiveRecord::Base
574 574 valid = s.valid_record ? 'TRUE' : 'FALSE'
575 575 time_viewed = s.time_viewed.nil? ? "NA": s.time_viewed.to_f / 1000.0
576 576 prompt = s.prompt
577   - csv << [ "Skip", s.id, s.skipper_id, s.question_id, s.prompt.left_choice.id, s.prompt.left_choice.data.strip, s.prompt.right_choice.id, s.prompt.right_choice.data.strip, s.prompt_id, s.appearance_id, s.skip_reason, s.created_at, s.updated_at, time_viewed , s.missing_response_time_exp, s.skipper.identifier,valid]
  577 + csv << [ "Skip", s.id, s.skipper_id, s.question_id, s.prompt.left_choice.id, s.prompt.left_choice.data.strip, s.prompt.right_choice.id, s.prompt.right_choice.data.strip, s.prompt_id, s.skip_reason, s.created_at, s.updated_at, time_viewed , s.missing_response_time_exp, s.skipper.identifier,valid]
578 578  
579 579 else
580 580 # If no skip and no vote, this is an orphaned appearance
581 581 prompt = a.prompt
582   - csv << [ "Orphaned Appearance", a.id, a.voter_id, a.question_id, a.prompt.left_choice.id, a.prompt.left_choice.data.strip, a.prompt.right_choice.id, a.prompt.right_choice.data.strip, a.prompt_id, 'N/A', 'N/A', a.created_at, a.updated_at, 'N/A', '', a.voter.identifier, 'TRUE']
  582 + csv << [ "Orphaned Appearance", a.id, a.voter_id, a.question_id, a.prompt.left_choice.id, a.prompt.left_choice.data.strip, a.prompt.right_choice.id, a.prompt.right_choice.data.strip, a.prompt_id, 'N/A', a.created_at, a.updated_at, 'N/A', '', a.voter.identifier, 'TRUE']
583 583 end
584 584 end
585 585 end
... ...