-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from codemancers/add-results-per-attempt
Added results per attempt
- Loading branch information
Showing
5 changed files
with
53 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,8 @@ | ||
<h1>Results</h1> | ||
<%= link_to "Download CSV", results_survey_path(id: params[:id], format: :csv) %> | ||
<%- @survey_results.each do |result| %> | ||
<div> | ||
<h4><%= result.question.question_text %></h4> | ||
<p> | ||
<%- if result.results.is_a?(Array) %> | ||
<ol> | ||
<%- result.results.each do |answer| %> | ||
<li><%= answer %></li> | ||
<% end %> | ||
</ol> | ||
<% elsif result.results.is_a?(Hash) %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Option</th> | ||
<th>Count</th> | ||
<th>Filter</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%- result.results.each do |option, count| %> | ||
<tr> | ||
<td><%= option %></td> | ||
<td><%= count %></td> | ||
<td><%= filter_link(result.question.id, option) %></th> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% end %> | ||
<%- @survey_attempts.each do |attempt| %> | ||
<div class="flex justify between"> | ||
<h4>User : <%= attempt.user_id %></h4> | ||
<%= link_to "View Answers", survey_result_path(@survey, attempt.id) %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h1>Survey Result</h1> | ||
|
||
<p><strong>Survey Name:</strong> <%= @survey.name %></p> | ||
<p><strong>User ID:</strong> <%= @attempt.user_id %></p> | ||
|
||
<div> | ||
<% @answers.each do |answer| %> | ||
<div class="question-answer-pair"> | ||
<p><strong>Question:</strong> <%= answer.question.question_text %></p> | ||
<p><strong>Answer:</strong> <%= answer.answer_text %></p> | ||
<hr> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
|
||
<%= link_to "Back to All Results", results_survey_path(@survey) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters