Commit a43ab92a804328a83e433db3e0861476ab44e829

Authored by Dhruv Kapadia
1 parent 53182fda

Adding response time and missing response time exp to csv

Showing 1 changed file with 9 additions and 5 deletions   Show diff stats
app/models/question.rb
... ... @@ -378,7 +378,7 @@ class Question < ActiveRecord::Base
378 378  
379 379 headers = ['Vote ID', 'Session ID', 'Question ID','Winner ID', 'Winner Text', 'Loser ID', 'Loser Text',
380 380 'Prompt ID', 'Left Choice ID', 'Right Choice ID', 'Created at', 'Updated at', 'Appearance ID',
381   - 'Response Time (s)', 'Session Identifier']
  381 + 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier']
382 382  
383 383 when 'ideas'
384 384 outfile = "ideamarketplace_#{self.id}_ideas.csv"
... ... @@ -389,7 +389,7 @@ class Question < ActiveRecord::Base
389 389 outfile = "ideamarketplace_#{self.id}_non_votes.csv"
390 390 headers = ['Record Type', 'Record ID', 'Session ID', 'Question ID','Left Choice ID', 'Left Choice Text',
391 391 'Right Choice ID', 'Right Choice Text', 'Prompt ID', 'Appearance ID', 'Reason',
392   - 'Created at', 'Updated at', 'Response Time (s)', 'Session Identifier']
  392 + 'Created at', 'Updated at', 'Response Time (s)', 'Missing Response Time Explanation', 'Session Identifier']
393 393 else
394 394 raise "Unsupported export type: #{type}"
395 395 end
... ... @@ -411,9 +411,11 @@ class Question < ActiveRecord::Base
411 411 left_id = v.prompt.nil? ? "" : v.prompt.left_choice_id
412 412 right_id = v.prompt.nil? ? "" : v.prompt.right_choice_id
413 413  
  414 + time_viewed = v.time_viewed.nil? ? "NA": v.time_viewed.to_f / 1000.0
  415 +
414 416 csv << [ v.id, v.voter_id, v.question_id, v.choice_id, "'#{v.choice.data.strip}'", v.loser_choice_id, loser_data,
415 417 v.prompt_id, left_id, right_id, v.created_at, v.updated_at, v.appearance_id,
416   - v.time_viewed.to_f / 1000.0 , v.voter.identifier]
  418 + time_viewed, v.missing_response_time_exp , v.voter.identifier]
417 419 end
418 420  
419 421 when 'ideas'
... ... @@ -444,15 +446,17 @@ class Question &lt; ActiveRecord::Base
444 446 prompt = a.prompt
445 447 csv << [ "Orphaned Appearance", a.id, a.voter_id, a.question_id, a.prompt.left_choice.id, a.prompt.left_choice.data.strip,
446 448 a.prompt.right_choice.id, a.prompt.right_choice.data.strip, a.prompt_id, 'N/A', 'N/A',
447   - a.created_at, a.updated_at, 'N/A', a.voter.identifier]
  449 + a.created_at, a.updated_at, 'N/A', '', a.voter.identifier]
448 450  
449 451 else
  452 +
450 453 #If this appearance belongs to a skip, show information on the skip instead
451 454 s = a.skip
  455 + time_viewed = s.time_viewed.nil? ? "NA": s.time_viewed.to_f / 1000.0
452 456 prompt = s.prompt
453 457 csv << [ "Skip", s.id, s.skipper_id, s.question_id, s.prompt.left_choice.id, s.prompt.left_choice.data.strip,
454 458 s.prompt.right_choice.id, s.prompt.right_choice.data.strip, s.prompt_id, s.appearance_id, s.skip_reason,
455   - s.created_at, s.updated_at, s.time_viewed.to_f / 1000.0 , s.skipper.identifier]
  459 + s.created_at, s.updated_at, time_viewed , s.missing_response_time_exp, s.skipper.identifier]
456 460 end
457 461 end
458 462 end
... ...