From 28e8f157bb2da719622ed97f6b54746b0f67df0d Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Tue, 14 Mar 2017 15:36:53 -0400 Subject: [PATCH] fixing data --- app/views/questions/_question.html.haml | 9 ++++----- app/views/shared/_histogram.html.haml | 2 ++ lib/tasks/data.rake | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 app/views/shared/_histogram.html.haml diff --git a/app/views/questions/_question.html.haml b/app/views/questions/_question.html.haml index 10ad2895..55b486c4 100644 --- a/app/views/questions/_question.html.haml +++ b/app/views/questions/_question.html.haml @@ -24,15 +24,14 @@ .clearfix - -# .show-hide %p %span{class: 'toggle', data: {toggle: 'histogram-answers'}}= "Show Histogram".html_safe   |   %span{class: 'toggle', data: {toggle: 'raw'}}= "Show Raw Data".html_safe - - if question.is_a?(Question) || question.is_a?(GroupedQuestion) - .histogram-answers.hidden - = render question + .histogram-answers.hidden + = render 'shared/histogram', data: aggregated_responses - %p.raw.hidden= likerts.join(', ') + %p.raw.hidden + = aggregated_responses.responses.map(&:answer_index).join(', ') diff --git a/app/views/shared/_histogram.html.haml b/app/views/shared/_histogram.html.haml new file mode 100644 index 00000000..70a94878 --- /dev/null +++ b/app/views/shared/_histogram.html.haml @@ -0,0 +1,2 @@ +%p + =# data.inspect diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index 04d5d882..abe2d17c 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -196,7 +196,7 @@ namespace :data do end responded_at = Date.strptime(row['EndDate'], '%m/%d/%Y %H:%M:%S') - recipient.attempts.create(question: question, answer_index: answer_index, responded_at: responded_at) + recipient.attempts.create(question: question, answer_index: answer_index + 1, responded_at: responded_at) end end end