Skip to content

Commit

Permalink
Merge pull request #1054 from michaelamoran/master
Browse files Browse the repository at this point in the history
Add draggable reordering capability to the review report for instructors
  • Loading branch information
ferryxo committed Oct 26, 2017
2 parents a26cf3a + 11f958b commit 781e456
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 48 deletions.
115 changes: 72 additions & 43 deletions app/views/review_mapping/_review_report.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<!-- the table creation is changed top accomodate functionality of tablesorter, which requires thead and tbody seperately. Previously, headers were in tbody only -->
<div class = 'reviewreport'>
<!-- Added headers for tablesorter -->

<script type='text/javascript'>
$(window).load(function(){
$("#myTable tbody").sortable().disableSelection();
});
</script>

<table id="myTable" class="tbl_heat tablesorter" width="100%" cellspacing='0' cellpadding='2' border='0'>
<thead>
<tr bgcolor='#CCCCCC'>
Expand All @@ -28,76 +35,97 @@
<%if r.id != -1 %>
<% user = Participant.find(r.id).user %>
<!--reviewer-->
<td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan%>>
<td bgcolor=<%= @bgcolor %>>
<%= link_to user.name, impersonate_impersonate_path(:user => {:name => user.name}), :method => :post %>
(<%= user.fullname %>)
</td>
<!--# reviews done-->
<td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan%> align = 'left'>
<td bgcolor=<%= @bgcolor %> align = 'left'>
<% (1..@assignment.num_review_rounds).each do |round| %>
<%= instance_variable_get("@review_in_round_" + round.to_s) %>/<%= @rspan %>
<%= ', ' unless round == @assignment.num_review_rounds %>
<% end %>
<%= link_to "summary", {:controller => 'popup', :action => 'view_review_scores_popup', :reviewer_id => r.id, :assignment_id=>@id}, target: :_blank %>
</td>


<!--Team reviewed / Author feedback-->
<td bgcolor=<%= @bgcolor %> align = 'left'>
<% @response_maps.each_with_index do |ri, index| %>
<!--For assignments with team member 1, team reviewed column should show username instead of team name, which is randomly generated.-->
<% team_name_color = get_team_name_color(ri) %>
<% team_reviewed_link_name = get_team_reviewed_link_name(@assignment.max_team_size, ri.response, ri.reviewee_id) %>
<% if Team.where(id: ri.reviewee_id).length > 0 %>
<%@team = Team.find(ri.reviewee_id) %>
<!--Team reviewed-->
<td id = <%= team_name_color %> bgcolor=<%= @bgcolor %> align = 'left' colspan=1>
<%= link_to team_reviewed_link_name, :controller => 'popup', :action => 'team_users_popup', :id => ri.reviewee_id, :id2 => ri.id, :assignment_id=>@id %>
<%= list_review_submissions(r.id, ri.reviewee_id, ri.id) %>
<!--Hard-coded Dr.Kidd's question in order to display link.-->
<!--later we can create a hyperlink question type to deal with this situation.-->
<%= list_hyperlink_submission(ri.id, 5386) if @id.to_i == 806 %>
</td>
<% if index == 0 %>
<div>
<% else %>
<div style="border-top: solid; border-width: 1px;">
<% end %>
<%= link_to team_reviewed_link_name, :controller => 'popup', :action => 'team_users_popup', :id => ri.reviewee_id, :id2 => ri.id, :assignment_id=>@id %>
<%= list_review_submissions(r.id, ri.reviewee_id, ri.id) %>
<!--Hard-coded Dr.Kidd's question in order to display link.-->
<!--later we can create a hyperlink question type to deal with this situation.-->
<%= list_hyperlink_submission(ri.id, 5386) if @id.to_i == 806 %>
</div>

<!--Author feedback-->
<!--Dr.Kidd required to add a "autor feedback" column that shows the average score the reviewers received from the authors. In this case, she can see all the data on a single screen.-->
<!--Dr.Kidd's course-->
<% if @assignment.instructor_id == 2026 %>
<td id = <%= team_name_color %> bgcolor=<%= @bgcolor %> align = 'left' colspan=1>
<% if index == 0 %>
<div>
<% else %>
<div style="border-top: solid; border-width: 1px;">
<% end %>
<%= calcutate_average_author_feedback_score(@assignment.id, @assignment.max_team_size, ri.id, ri.reviewee_id) %>
</td>
</div>
<% end %>

<!--Score awarded / Avg. score-->
<%= render partial: 'team_score', locals: {bgcolor: @bgcolor, team_id: @team.id, reviewer_id: r.id} %>
<% if index == 0 %>
<!--Metrics-->
<td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan%> align = 'left'>
<%= display_volume_metric(r.overall_avg_vol, r.avg_vol_in_round_1, r.avg_vol_in_round_2, r.avg_vol_in_round_3) %>
</td>
<!--Assign grade and write comments-->
<td bgcolor=<%= @bgcolor %> rowspan= <%= @rspan%> align = 'left'>
<%= form_tag 'save_grade_and_comment_for_reviewer', remote: true do %>
<%= hidden_field_tag :participant_id, r.id %>
<%= hidden_field_tag :assignment_id, @id %>
<%= number_field_tag 'grade_for_reviewer', r.review_grade.try(:grade_for_reviewer) ,min: 0, max: 100, maxlength: 3, size: 3, placeholder: 'Grade' %><br/>
<%= text_area_tag 'comment_for_reviewer', r.review_grade.try(:comment_for_reviewer), placeholder: 'Comment', class: "awesome_input", 'data-multiple' => '', 'data-minchars' => "1" %>
<table class="inline-transparent">
<tr>
<td>
<%= image_tag 'text_macro.png', :border => 2, :title => 'Text Macro/Pastebin', :style => 'width: 24px; height:30px', :onclick => 'show_text_macros()'%>
</td>
</tr>
<tr>
<td>
<%= submit_tag 'Save' %>
</td>
</tr>
</table>
<% end %>
</td>
<% end %>
</tr><tr class = "tablesorter-childRow">
<%end%>
<%end %>
</td>


<!--Score awarded / Avg. score-->
<td bgcolor=<%= @bgcolor %> align = 'left' >
<% @response_maps.each_with_index do |ri, index| %>
<% if Team.where(id: ri.reviewee_id).length > 0 %>
<%@team = Team.find(ri.reviewee_id) %>
<%= render partial: 'team_score', locals: {bgcolor: @bgcolor, team_id: @team.id, reviewer_id: r.id} %>
<%end %>
<%end %>
</td>


<!--Metrics-->
<td bgcolor=<%= @bgcolor %> align = 'left'>
<%= display_volume_metric(r.overall_avg_vol, r.avg_vol_in_round_1, r.avg_vol_in_round_2, r.avg_vol_in_round_3) %>
</td>
<!--Assign grade and write comments-->
<td bgcolor=<%= @bgcolor %> align = 'left'>
<%= form_tag 'save_grade_and_comment_for_reviewer', remote: true do %>
<%= hidden_field_tag :participant_id, r.id %>
<%= hidden_field_tag :assignment_id, @id %>
<%= number_field_tag 'grade_for_reviewer', r.review_grade.try(:grade_for_reviewer) ,min: 0, max: 100, maxlength: 3, size: 3, placeholder: 'Grade' %><br/>
<%= text_area_tag 'comment_for_reviewer', r.review_grade.try(:comment_for_reviewer), placeholder: 'Comment', class: "awesome_input", 'data-multiple' => '', 'data-minchars' => "1" %>
<table class="inline-transparent">
<tr>
<td>
<%= image_tag 'text_macro.png', :border => 2, :title => 'Text Macro/Pastebin', :style => 'width: 24px; height:30px', :onclick => 'show_text_macros()'%>
</td>
</tr>
<tr>
<td>
<%= submit_tag 'Save' %>
</td>
</tr>
</table>
<% end %>
</td>



<%end %>
</tr>
<%end %>
</table>
Expand Down Expand Up @@ -165,3 +193,4 @@ $.tablesorter.addParser({
type: 'numeric'
});
</script>

10 changes: 5 additions & 5 deletions app/views/review_mapping/_team_score.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if !@assignment.varying_rubrics_by_round? %>
<!--Score awarded / Avg. score-->
<td bgcolor=<%= bgcolor %> align = 'left' >
<div style="border-top: solid; border-width: 1px">
<% if @review_scores[reviewer_id][team_id] != -1%>
<%= @review_scores[reviewer_id][team_id].inspect %>%
<% else %>
Expand All @@ -12,12 +12,12 @@
<%else%>
--
<%end%>
</td>
</div>
<%else%>
<!--Assignments have vary_rubric_by_rounds-->
<!--Score awarded / Avg. score-->
<% get_each_round_score_awarded_for_review_report(reviewer_id, team_id) %>
<td bgcolor=<%= bgcolor %> align = 'left' >
<div style="border-top: solid; border-width: 1px">
<% (1..@assignment.num_review_rounds).each do |round| %>
<% get_min_max_avg_value_for_review_report(round, team_id) %>
<%= instance_variable_get("@score_awarded_round_" + round.to_s) %> / <%= @avg %>
Expand All @@ -27,5 +27,5 @@
(<%= @min %>% - <%= @max %>%)
</td>-->
<%end%>
</td>
<%end%>
</div>
<%end%>

0 comments on commit 781e456

Please sign in to comment.