-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XSLX and CSV formats to reports, add HTML report for sessions
- Loading branch information
D Coetzee
committed
Jan 8, 2015
1 parent
af9f6e2
commit 37f8497
Showing
11 changed files
with
128 additions
and
10 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
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
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,12 @@ | ||
model_class = EventLog | ||
csv << ['Session chat group'] + [:created_at, :task_id, :chat_group, :name, :value].map{|attr| model_class.human_attribute_name(attr)} | ||
@eventlog_sessions.each do |session| | ||
session.each do |event| | ||
csv << [event.task.original_chat_group, | ||
event.created_at, | ||
event.task_id, | ||
event.chat_group, | ||
event.name, | ||
event.value] | ||
end | ||
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
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,18 @@ | ||
model_class = EventLog | ||
wb = xlsx_package.workbook | ||
wb.add_worksheet(name: "Chat Log") do |sheet| | ||
time_format = wb.styles.add_style :format_code => 'MM/DD hh:mm:ss' | ||
sheet.add_row (['Session chat group'] + [:created_at, :task_id, :chat_group, :name, :value].map{|attr| model_class.human_attribute_name(attr)}) | ||
@eventlog_sessions.each do |session| | ||
session.each do |event| | ||
sheet.add_row [event.task.original_chat_group, | ||
event.created_at, | ||
event.task_id, | ||
event.chat_group, | ||
event.name, | ||
event.value], | ||
:style => [nil, time_format], | ||
:types => [:string, :time, :integer, :string, :string, :string] | ||
end | ||
end | ||
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
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,12 @@ | ||
csv << ['chat_group', 'group_size', | ||
'question_id', 'correct_choice', | ||
'start_time_0', 'start_time_1', 'start_time_2', | ||
'initial_choice_0', 'initial_choice_1', 'initial_choice_2', | ||
'final_choice_0', 'final_choice_1', 'final_choice_2'] | ||
@sessions.each do |session| | ||
csv << [session[:chat_group], session[:group_size], | ||
session[:question_id], session[:correct_choice], | ||
session[:start_time_0], session[:start_time_1], session[:start_time_2], | ||
session[:initial_choice_0], session[:initial_choice_1], session[:initial_choice_2], | ||
session[:final_choice_0], session[:final_choice_1], session[:final_choice_2]] | ||
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,34 @@ | ||
<table class="table"> | ||
<tr> | ||
<th>chat_group</th> | ||
<th>group_size</th> | ||
<th>question_id</th> | ||
<th>correct_choice</th> | ||
<th>start_time_0</th> | ||
<th>start_time_1</th> | ||
<th>start_time_2</th> | ||
<th>initial_choice_0</th> | ||
<th>initial_choice_1</th> | ||
<th>initial_choice_2</th> | ||
<th>final_choice_0</th> | ||
<th>final_choice_1</th> | ||
<th>final_choice_2</th> | ||
</tr> | ||
<% @sessions.each do |session| %> | ||
<tr> | ||
<td><%= session[:chat_group] %></td> | ||
<td><%= session[:group_size] %></td> | ||
<td><%= session[:question_id] %></td> | ||
<td><%= session[:correct_choice] %></td> | ||
<td><%= session[:start_time_0] %></td> | ||
<td><%= session[:start_time_1] %></td> | ||
<td><%= session[:start_time_2] %></td> | ||
<td><%= session[:initial_choice_0] %></td> | ||
<td><%= session[:initial_choice_1] %></td> | ||
<td><%= session[:initial_choice_2] %></td> | ||
<td><%= session[:final_choice_0] %></td> | ||
<td><%= session[:final_choice_1] %></td> | ||
<td><%= session[:final_choice_2] %></td> | ||
</tr> | ||
<% end %> | ||
</table> |
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,22 @@ | ||
wb = xlsx_package.workbook | ||
wb.add_worksheet(name: "Sessions") do |sheet| | ||
time_format = wb.styles.add_style :format_code => 'MM/DD hh:mm:ss' | ||
sheet.add_row ['chat_group', 'group_size', | ||
'question_id', 'correct_choice', | ||
'start_time_0', 'start_time_1', 'start_time_2', | ||
'initial_choice_0', 'initial_choice_1', 'initial_choice_2', | ||
'final_choice_0', 'final_choice_1', 'final_choice_2'] | ||
@sessions.each do |session| | ||
sheet.add_row [session[:chat_group], session[:group_size], | ||
session[:question_id], session[:correct_choice], | ||
session[:start_time_0], session[:start_time_1], session[:start_time_2], | ||
session[:initial_choice_0], session[:initial_choice_1], session[:initial_choice_2], | ||
session[:final_choice_0], session[:final_choice_1], session[:final_choice_2]], | ||
:style => [nil, nil, nil, nil, time_format, time_format, time_format], | ||
:types => [:string, :integer, | ||
:integer, :string, | ||
:time, :time, :time, | ||
:string, :string, :string, | ||
:string, :string, :string] | ||
end | ||
end |