<commit_before><%-# Fedena
#Copyright 2010 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing,
#software distributed under the License is distributed on an
#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, either express or implied.  See the License for the
#specific language governing permissions and limitations
#under the License. -%>

<%= javascript_include_tag "sortable" %>
<div id="content-header">
  <%= image_tag("/images/examination/show_exam.png") %>
  <h1><%= t('exams_text') %></h1>
  <h3><%= t('student_ranking_per_subject') %></h3>
  <div id="app-back-button">
    <%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
  </div>
</div>
<div id="inner-tab-menu">
  <ul>
    <li><%= link_to "#{t('pdf_report')}", {:controller => "exam", :action => "student_subject_rank_pdf", :subject_id=> @subject.id, :page_height=>1150},:target => '_blank' %></li>
  </ul>
</div>

<div id="page-yield">

  <% unless flash[:notice].nil? %>
    <p class="flash-msg"> <%= flash[:notice] %> </p>
  <% end %>

  <div class="box">
    <h4><%= @batch.name %> - <%= @batch.course.full_name %> | <%= @subject.name %></h4>
    <div id="score-table">
      <table class ="sortable" id="listing" width="100%" cellpadding="1" cellspacing="1" onload="sortables_init()" >
        <tr class="tr-head">
          <th class="unsortable"><%= t('sl_no') %></th>
          <th><%= t('adm_no') %></th>
          <th><%= t('name') %></th>
          <% ranks = [] %>
          <% @exam_groups.each do |exam_group| %>
            <% rank_exam = Exam.find_by_subject_id(@subject.id,:conditions=>{:exam_group_id=>exam_group.id}) %>
            <% unless rank_exam.nil? %>
              <% exam_scores = ExamScore.find_all_by_exam_id(rank_exam.id) %>
              <% ordered_marks = exam_scores.map{|m| m.marks}.compact.uniq.sort.reverse %>
              <% ranks << [exam_group.id,ordered_marks] %>
            <% end %>
            <th><%= exam_group.name %></th>
          <% end %>
        </tr>
        <% @students.each_with_index do |student,i| %>
          <tr class="tr-<%= cycle('odd', 'even') %>">
            <td class="col-1"><%= i+1 %></td>
            <td class="col-1"><%= student.admission_no.present? ? student.admission_no : "-" %></td>
            <td class="col-2"><%= student.full_name %></td>
            <% @exam_groups.each do |exam_group| %>
              <% mark_list = [] %>
              <% ranks.each do|rank| %>
                <% if rank[0]==exam_group.id %>
                  <% mark_list = rank[1] %>
                <% end %>
              <% end %>
              <td class="col-3">
                <% exam = Exam.find_by_subject_id(@subject.id,:conditions=>{:exam_group_id=>exam_group.id}) %>
                <% exam_score = ExamScore.find_by_student_id(student.id,:conditions=>{:exam_id=>exam.id}) unless exam.nil? %>
                <% unless exam.nil? %>
                  <%= exam_score.nil? ? '-' : (exam_score.marks.nil? ? '-' : (mark_list.index(exam_score.marks) + 1)) %>
                <% else %>
                  <%= "#{t('n_a')}" %>
                <% end %>
              </td>
            <% end %>
          </tr>
        <% end %>
      </table>
    </div>
    <div class="extender"></div>
  </div><commit_msg>BUG #3626 fixed<commit_after><%-# Fedena
#Copyright 2010 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing,
#software distributed under the License is distributed on an
#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, either express or implied.  See the License for the
#specific language governing permissions and limitations
#under the License. -%>

<%= javascript_include_tag "sortable" %>
<div id="content-header">
  <%= image_tag("/images/examination/show_exam.png") %>
  <h1><%= t('exams_text') %></h1>
  <h3><%= t('student_ranking_per_subject') %></h3>
  <div id="app-back-button">
    <%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
  </div>
</div>
<div id="inner-tab-menu">
  <ul>
    <li><%= link_to "#{t('pdf_report')}", {:controller => "exam", :action => "student_subject_rank_pdf", :subject_id=> @subject.id, :page_height=>1150},:target => '_blank' %></li>
  </ul>
</div>

<div id="page-yield">

  <% unless flash[:notice].nil? %>
    <p class="flash-msg"> <%= flash[:notice] %> </p>
  <% end %>

  <div class="box">
    <h4><%= @batch.name %> - <%= @batch.course.full_name %> | <%= @subject.name %></h4>
    <div id="score-table">
      <table class ="sortable" id="listing" width="100%" cellpadding="1" cellspacing="1" onload="sortables_init()" >
        <tr class="tr-head">
          <th class="unsortable"><%= t('sl_no') %></th>
          <th><%= t('adm_no') %></th>
          <th><%= t('name') %></th>
          <% ranks = [] %>
          <% @exam_groups.each do |exam_group| %>
            <% rank_exam = Exam.find_by_subject_id(@subject.id,:conditions=>{:exam_group_id=>exam_group.id}) %>
            <% unless rank_exam.nil? %>
              <% exam_scores = ExamScore.find_all_by_exam_id(rank_exam.id) %>
              <% ordered_marks = exam_scores.map{|m| m.marks}.compact.uniq.sort.reverse %>
              <% ranks << [exam_group.id,ordered_marks] %>
            <% end %>
            <th><%= exam_group.name %></th>
          <% end %>
        </tr>
        <% @students.each_with_index do |student,i| %>
          <tr class="tr-<%= cycle('odd', 'even') %>">
            <td class="col-1"><%= i+1 %></td>
            <td class="col-3"><%= student.admission_no.present? ? student.admission_no : "-" %></td>
            <td class="col-2"><%= student.full_name %></td>
            <% @exam_groups.each do |exam_group| %>
              <% mark_list = [] %>
              <% ranks.each do|rank| %>
                <% if rank[0]==exam_group.id %>
                  <% mark_list = rank[1] %>
                <% end %>
              <% end %>
              <td class="col-3">
                <% exam = Exam.find_by_subject_id(@subject.id,:conditions=>{:exam_group_id=>exam_group.id}) %>
                <% exam_score = ExamScore.find_by_student_id(student.id,:conditions=>{:exam_id=>exam.id}) unless exam.nil? %>
                <% unless exam.nil? %>
                  <%= exam_score.nil? ? '-' : (exam_score.marks.nil? ? '-' : (mark_list.index(exam_score.marks) + 1)) %>
                <% else %>
                  <%= "#{t('n_a')}" %>
                <% end %>
              </td>
            <% end %>
          </tr>
        <% end %>
      </table>
    </div>
    <div class="extender"></div>
  </div>
{'fraction_non_alphanumeric': 0.19728915662650603, 'fraction_numerical': 0.009309967141292442, 'mean_word_length': 2.544395924308588, 'pattern_counts': {'":': 0, '<': 195, '<?xml version=': 0, '>': 215, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1359410', 'n_tokens_mistral': 2662, 'n_tokens_neox': 2405, 'n_words': 497}