expertiza/expertiza

View on GitHub
app/views/student_task/list.html.erb

Summary

Maintainability
Test Coverage
<h1><%=t ".assignments" %></h1>


<div style="">
  <div class="taskbox" style="width:18%; display: inline; float:left; margin-right: 10px;" >
    <strong>&nbsp;&nbsp;<span class="tasknum">&nbsp;<%= @tasknotstarted.size.to_s %>&nbsp;</span> <%=t ".tasks_not_started" %><br></strong><br>

    <% @tasknotstarted.each do |student_task|
      participant = student_task.participant
      stage = student_task.current_stage
      controller = ""
      action = ""
      if stage == "submission" || stage == 'signup'
        controller = "submitted_content"
        action = "edit"

        # check if the assignment has a sign-up sheet
        if Assignment.find(participant.assignment.id).topics?
          selected_topics = nil

          #ACS Get the topics selected by all teams
          #removed code that handles team and individual assignments differently
          # get the user's team and check if they have signed up for a topic yet
          users_team = SignedUpTeam.find_team_users(participant.assignment.id,participant.user.id)
          if users_team.size > 0
            selected_topics = SignedUpTeam.find_user_signup_topics(participant.assignment.id,users_team[0].t_id)
          end

          if selected_topics.nil? || selected_topics.length == 0
            # there is a signup sheet and user/team hasn't signed up yet, produce a link to do so
            controller = "sign_up_sheet"
            action = "list"
            end
          end
      elsif stage == "review" or stage == "metareview"
        assignment = Assignment.find(participant.assignment.id)
        if assignment.bidding_for_reviews_enabled == 'Bidding' and assignment.can_choose_topic_to_review?
          controller = "review_bids"
          action = "show"
        elsif assignment.bidding_for_reviews_enabled == 'Bidding'
          controller = "review_bids"
          action = "index"
        else
          controller = "student_review"
          action = "list"
        end
      end
     %>

    <span>&nbsp; &raquo;
      <%= link_to student_task.assignment.name + " " + student_task.current_stage, :controller => controller, :action => action, :id => participant.id %>
      (<%= student_task.relative_deadline %> <%=t ".left" %>)
    </span><br/>
  <% end %>

  <br/> <strong> &nbsp;&nbsp;<span class="revnum">&nbsp;<%= @taskrevisions.size.to_s %>&nbsp;</span> <%=t ".revisions" %><br></strong><br>
  <% @taskrevisions.each do |student_task|
    participant = student_task.participant
    stage = student_task.current_stage
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)
    duedate = participant.assignment.stage_deadline(topic_id)
    controller = ""
    action = ""
    if stage == "submission"
      controller = "submitted_content"
      action = "edit"
    elsif stage == "review" or stage == "metareview"
      controller = "student_review"
      action = "list"
    end
  %>

<span>&nbsp; &raquo; <%= link_to participant.assignment.name + " " +
  stage, :controller => controller, :action => action, :id => participant.id %>
(<%= time_ago_in_words(duedate) %> left) </span><br/>
<% end %>
<br/>

<strong><%=t ".student_team" %><br></strong><br>

<% @students_teamed_with.keys.each do |course_id| %>
    <strong>&nbsp;&nbsp;<span class="tasknum">&nbsp;<%= @students_teamed_with[course_id].size.to_s %>&nbsp;</span>
      <%if course_id.nil?%>
        <%=t ".not_associated" %>
      <%else%>
        <%=  Course.find(course_id).name %>
      <%end%>
      <br></strong><br>
    <% if @students_teamed_with[course_id].size %>
        <% @students_teamed_with[course_id].each do |student|%>
                <span class="notification">&nbsp; &raquo; <%= student %> </span><br/>
        <% end %>
    <% end %>
<% end %>
</div>
<div class="topictable" style="float: left;width: 80%;margin-bottom: 10px; display: inline; ">
 <table class="table table-striped" cellpadding="2">
    <tr class="taskheader">
      <th><%=t ".assignment_name" %></th>
      <th><%=t ".course" %></th>
      <th><%=t ".topic" %></th>
      <th><%=t ".current_stage" %></th>
      <th><%=t ".review_grade" %></th>
      <th><%=t ".badges" %></th>
      <th><%=t ".stage_deadline" %><img src="/assets/info.png" title="You can change 'Preferred Time Zone' in 'Profile' in the banner."/></th>
      <th><%=t ".publishing_rights" %><img src="/assets/info.png" title="Grant publishing rights"/></th>
    </tr>
    <% @student_tasks.each do |student_task| %>
      <% participant = student_task.participant %>
      <% if student_task.assignment %>
        <tr class="listingRow">
          <!--assignment-->
          <td><b><%= link_to student_task.assignment.name, :action => 'view', :id => participant %></b></td>
          <!--course-->
          <td><%= student_task.course.try :name %></td>
          <!--topic-->
          <% topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id) %>
          <% if SignUpTopic.exists?(topic_id) %>
            <td><%= SignUpTopic.find(topic_id).try :topic_name %></td>
          <% else %>
            <td>-</td>
          <% end %>
          <!--current stage-->
          <td>
          <% if participant.assignment.link_for_current_stage(topic_id)!= nil && participant.assignment.link_for_current_stage(topic_id).length!=0%>
              <%= link_to participant.assignment.current_stage_name(topic_id), participant.assignment.link_for_current_stage(topic_id) %>
              <% else %>
              <%= participant.assignment.current_stage_name(topic_id) %>
              <% end %>
          </td>
          <!--review grade-->

          <td><%= get_review_grade_info(participant) %></td>
          <!--badges-->
          <td><%= get_awarded_badges(participant) %></td>
          <!--stage deadline-->
          <td><%= student_task.stage_deadline.in_time_zone(session[:user].timezonepref) %></td>
          <!--publish rights-->

          <td align=center>
        <input class='make-permit-change' id="<%= participant.id %>" type="checkbox" <% if participant.permission_granted %>checked<%end%>>
</td>

        </tr>
      <% end %>
    <% end %>
  </table>
</div>
</div>