%-# 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. -%>
<% if @mode=="batch" %>
<%= @ranking_level.name %> <%= t('students') %>
<%= @batch.full_name %> <%= " | #{t('subject')} : "+@subject.name if @subject.present? %>
<% unless @scores.empty? %>
<% if @report_type=="subject" %>
<% ranked_students = Student.find_all_by_id(@scores.collect(&:student_id)) %>
<% ranked_students = ranked_students.reject{|st| st.has_higher_priority_ranking_level(@ranking_level.id,"subject",@subject.id)==true} %>
<% else %>
<% unless @ranking_level.subject_count.nil? %>
<% sub_count = @ranking_level.subject_count %>
<% ranked_students = [] %>
<% @students.each do|student| %>
<% @student_scores = @scores.dup %>
<% @student_scores.reject!{|s| !(s.student_id==student.id)} %>
<% if @ranking_level.subject_limit_type=="upper" %>
<% if @student_scores.count < sub_count %>
<% ranked_students << student %>
<% end %>
<% elsif @ranking_level.subject_limit_type=="exact" %>
<% if @student_scores.count == sub_count %>
<% ranked_students << student %>
<% end %>
<% else %>
<% if @student_scores.count >= sub_count %>
<% ranked_students << student %>
<% end %>
<% end %>
<% end %>
<% else %>
<% ranked_students = Student.find_all_by_id(@scores.collect(&:student_id)) %>
<% end %>
<% ranked_students = ranked_students.reject{|st| st.has_higher_priority_ranking_level(@ranking_level.id,"overall","")==true} %>
<% end %>
<% unless ranked_students.empty? %>
<% c = 'even' %>
<% ranked_students.each_with_index do |s,ind| %>
">
<%= ind+1 %> |
<%= s.admission_no.present? ? s.admission_no : "-" %> |
<%= s.full_name %> |
<% end %>
<% else %>
<%= "#{t('no_text')} #{@ranking_level.name} #{t('students_found')}" %>
<% end %>
<% else %>
<%= "#{t('no_text')} #{@ranking_level.name} #{t('students_found')}" %>
<% end %>
<% else %>
<%= @ranking_level.name %> <%= t('students') %>
<%= @course.full_name %>
<% unless @scores.empty? %>
<% unless @ranking_level.subject_count.nil? %>
<% sub_count = @ranking_level.subject_count %>
<% ranked_students = [] %>
<% unless @ranking_level.full_course==true %>
<% @students.each do|student| %>
<% @student_scores = @scores.dup %>
<% @student_scores.reject!{|s| !(s.student_id==student.id)} %>
<% batch_ids = @student_scores.collect(&:batch_id) %>
<% batch_ids.each do|batch_id|%>
<% unless batch_ids.empty? %>
<% count = batch_ids.count(batch_id) %>
<% if @ranking_level.subject_limit_type=="upper" %>
<% if count < sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,batch_id] %>
<% end %>
<% end %>
<% elsif @ranking_level.subject_limit_type=="exact" %>
<% if count == sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,batch_id] %>
<% end %>
<% end %>
<% else %>
<% if count >= sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,batch_id] %>
<% end %>
<% end %>
<% end %>
<% batch_ids.delete(batch_id) %>
<% end %>
<% end %>
<% end %>
<% else %>
<% @students.each do|student| %>
<% @student_scores = @scores.dup %>
<% @student_scores.reject!{|s| !(s.student_id==student.id)} %>
<% if @ranking_level.subject_limit_type=="upper" %>
<% if @student_scores.count < sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,student.batch.id] %>
<% end %>
<% end %>
<% elsif @ranking_level.subject_limit_type=="exact" %>
<% if @student_scores.count == sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,student.batch.id] %>
<% end %>
<% end %>
<% else %>
<% if @student_scores.count >= sub_count %>
<% unless student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [student.id,student.batch.id] %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% else %>
<% ranked_students = [] %>
<% @scores.each do|score| %>
<% unless score.student.has_higher_priority_ranking_level(@ranking_level.id,"course","") %>
<% ranked_students << [score.student_id,score.batch_id] %>
<% end %>
<% end %>
<% end %>
<% unless ranked_students.empty? %>
<% c = 'even' %>
<% ranked_students.each_with_index do |s,i| %>
<% stu = Student.find(s[0]) %>
<% batch = Batch.find(s[1]) %>
">
<%= i+1 %> |
<%= stu.admission_no.present? ? stu.admission_no : "-" %> |
<%= stu.full_name %> |
<%= stu.batch.full_name %> |
<% unless @ranking_level.full_course==true %>
<%= batch.full_name %> |
<% end %>
<% end %>
<% else %>
<%= "#{t('no_text')} #{@ranking_level.name} #{t('students_found')}" %>
<% end %>
<% else %>
<%= "#{t('no_text')} #{@ranking_level.name} #{t('students_found')}" %>
<% end %>
<% end %>
<% if params[:page_height] %>
<% end %>