app/views/courses/show2.html.erb
<p id="notice" xmlns="http://www.w3.org/1999/html"><%= notice %></p>
<h1>
<%= @course %>,
<%= @course.period %>,
<%= @course.year %>
</h1>
<div class="rounded">
<% if @course.week<=@course.weeks_total %>
<p><strong>Week: <%= @course.week %></strong></p>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[week]', @course.week+1 %>
<%= submit_tag "next week", :confirm => "Are you sure?" %>
<% end %>
<% else %>
<p><strong>Course over</strong></p>
<% end %>
</div>
<h3>Registrations</h3>
<div class="indent">
<table class="striped">
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th colspan="<%= @course.weeks_total %>">Week points</th>
<th></th>
<% unless @course.reviews_total == 0 %>
<th colspan="<%= @course.reviews_total %>">Reviews</th>
<% end %>
<th></th>
<th>Total</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th>Student</th>
<th>Topic</th>
<th>Repository</th>
<th></th>
<% (1..@course.weeks_total).each do |week| %>
<th><%= week %></th>
<% end %>
<th></th>
<% (1..@course.reviews_total).each do |week| %>
<th><%= week %></th>
<% end %>
<th></th>
<th>point</th>
<th></th>
<th>Last instructor note</th>
<th></th>
</tr>
<% sort(@registrations).each do |registration| %>
<tr class='<%= active registration %>'>
<td><%= link_to registration.user, registration.user %></td>
<td><%= registration.topic %></td>
<td><%= link_to registration.repository, registration.repository %> </td>
<td></td>
<% (1..@course.weeks_total).each do |week| %>
<td><%= registration.points_for_week week %></td>
<% end %>
<td></td>
<% (1..@course.reviews_total).each do |week| %>
<td><%= registration.review_status_for_week week %></td>
<% end %>
<td></td>
<td style="text-align: center;"><b><%= registration.total_points %></b></td>
<td></td>
<td><%= truncate(registration.last_instructor_note_digest, :length => 25) %></td>
<td><%= link_to 'View or give feedback ', registration.user %></td>
</tr>
<% end %>
</table>
</div>
<h3>Current code review</h3>
<p><em><strong>
<% if @course.mandatory_reviews %>
mandatory for all participants
<% else %>
on voluntary basis
<% end %>
</strong></em></p>
<div class="rounded">
<% if @course.review_round==0 %>
<p>not started yet</p>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[review_round]', @course.review_round+1 %>
<%= submit_tag "start", :confirm => "Are you sure?" %>
<% end %>
<% elsif @course.review_round<2 %>
<p>
registration: <%= @course.review_registration %>
</p>
<% if @course.review_registration=="open" %>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[state]', 0 %>
<%= submit_tag "close registration", :confirm => "Are you sure?" %>
<% end %>
<% else %>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[state]', 1 %>
<%= submit_tag "open registration", :confirm => "Are you sure?" %>
<% end %>
<% end %>
<p> round: <%= @course.review_round %></p>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[review_round]', @course.review_round+1 %>
<%= submit_tag "next round", :confirm => "Are you sure?" %>
<% end %>
<% elsif @course.review_round<3 %>
<p>
registration: <%= @course.review_registration %>
</p>
<% if @course.review_registration=="open" %>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[state]', 0 %>
<%= submit_tag "close registration", :confirm => "Are you sure?" %>
<% end %>
<% else %>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[state]', 1 %>
<%= submit_tag "open registration", :confirm => "Are you sure?" %>
<% end %>
<% end %>
<p> round: <%= @course.review_round %></p>
<%= form_tag("/courses/#{@course.id}", :method => :put) do %>
<%= hidden_field_tag 'course[review_round]', @course.review_round+1 %>
<%= submit_tag "finnish", :confirm => "Are you sure?" %>
<% end %>
<% else %>
<p>finished for this course</p>
<% end %>
<p><em>Intention is that students register and you assign reviewers when the registration to a round is open.
When you close the status, students can see the repo that is assigned to them for review.</em></p>
</div>
<h3>Code reviews </h3>
<p>due to performace reasons, data not shown currently!</p>
<!--
<p><em><strong>
<% if @course.mandatory_reviews %>
mandatory for all participants
<% else %>
on voluntary basis
<% end %>
</strong></em></p>
<div class="rounded">
<% if @course.review_round>1 %>
<h4>Round 2</h4>
<table class="striped">
<tr class="bar">
<th></th>
<% @registrations.each do |student| %>
<th class='vertical'>
<div><%= student %></div>
</th>
<% end %>
</tr>
<% @registrations.each do |student| %>
<tr>
<td><%= link_to student.user, student.user %></td>
<% @registrations.each do |reviewed| %>
<td class='left'>
<%= student.reviewed_in_round(reviewed, 2) %>
</td>
<% end %>
</tr>
<% end %>
</tr>
</table>
<% end %>
<% if @course.review_round>0 %>
<h4>Round 1</h4>
<table class="striped">
<tr class="bar">
<th></th>
<% @registrations.each do |student| %>
<th class='vertical'>
<div><%= student.user %></div>
</th>
<% end %>
</tr>
<% @registrations.each do |student| %>
<tr>
<td><%= link_to student.user, student.user %></td>
<% @registrations.each do |reviewed| %>
<td class='left'>
<%= student.reviewed_in_round(reviewed, 1) %>
</td>
<% end %>
</tr>
<% end %>
</tr>
</table>
<% end %>
</div>
-->
<%= link_to 'Edit course data', edit_course_path(@course), :class => 'small-button' %>