<% if @status.on_summary %>
diff --git a/app/views/candidate/summary.html.erb b/app/views/candidate/summary.html.erb
index 4ab116c..5230789 100644
--- a/app/views/candidate/summary.html.erb
+++ b/app/views/candidate/summary.html.erb
@@ -5,8 +5,8 @@
Once you're done, hit the button at the bottom of the page to submit your answers.
- <%= form_tag(post_summary_path) do %>
- <% @quiz.each do |question| %>
+ <% @quiz.each do |question| %>
+ <%= form_for(:answer, url: post_summary_path, html:{id: 'summary-form'}) do |form| %>
@@ -21,20 +21,21 @@
<% end #questions loop %>
-
- <% if @status.can_submit %>
-
-
-
- <% else %>
-
Sorry, you must answer all questions before you can submit.
- <% end %>
-
<% end #form_tag %>
+ <% if @status.can_submit %>
+
+
+
+ <% else %>
+
Sorry, you must answer all questions before you can submit.
+ <% end %>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index b503f26..d52d09c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,16 +1,17 @@
Rails.application.routes.draw do
- get "/welcome", to: "candidate#welcome", as: :welcome
- get "/thankyou", to: "candidate#thankyou", as: :thankyou
- get "/saved", to: "candidate#saved", as: :saved
- get "/summary", to: "candidate#summary", as: :summary
- post "/summary", to: "candidate#update_summary", as: :post_summary
- post "/question", to: "candidate#update_question", as: :post_question
- get "/question", to: "candidate#question", as: :question
- post "/validate", to: "candidate#validate", as: :validate_candidate
+ post "/validate", to: "candidate#validate", as: :validate_candidate
+ get "/welcome", to: "candidate#welcome", as: :welcome
+ get "/thankyou", to: "candidate#thankyou", as: :thankyou
+ get "/saved", to: "candidate#saved", as: :saved
- # live coder partial
- get "/live-coder-entry/:question_id", to: "candidate#live_coder"
+ post "/question(/:answer_id)", to: "candidate#update_answer", as: :post_answer
+ get "/question(/:question_id)", to: "candidate#question", as: :question
+ get "/live-coder-entry/:question_id", to: "candidate#live_coder", as: :live_coder
+
+ post "/summary", to: "candidate#update_summary", as: :post_summary
+ get "/summary", to: "candidate#summary", as: :summary
root to: "candidate#welcome"
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
diff --git a/db/sql/candidate_quiz.sql b/db/sql/candidate_quiz.sql
new file mode 100644
index 0000000..0254f2d
--- /dev/null
+++ b/db/sql/candidate_quiz.sql
@@ -0,0 +1,9 @@
+select c.id candidate_id
+ , c.name, c.test_hash
+ , q.quiz_id, q.id question_id, a.id answer_id, q.sort
+ , q.question, q.category, q.input_type, q.input_options, a.answer
+ , ifnull(a.saved, false) saved, ifnull(a.submitted, false) submitted , a.updated_at
+from candidates c
+ inner join questions q on q.quiz_id = c.quiz_id
+ left join answers a on a.candidate_id = c.id AND a.question_id = q.id
+order by c.name, q.sort;
diff --git a/test/fixtures/answers.yml b/test/fixtures/answers.yml
index f617658..ef29517 100644
--- a/test/fixtures/answers.yml
+++ b/test/fixtures/answers.yml
@@ -75,7 +75,7 @@ dawn6:
dawn7:
candidate: dawn
question: fed7
- answer: {html: '
This means jQuery needs to be available in live-coder!