<% 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? %>
<%= t('sl_no') %> |
<%= t('adm_no') %> |
<%= t('name') %> |
<% ranked_students.each_with_index do |s,i| %>
<%= i+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 %>
<% 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? %>
<%= t('sl_no') %> |
<%= t('adm_no') %> |
<%= t('name') %> |
<%= t('batch') %> |
<% unless @ranking_level.full_course==true %>
<%= "#{@ranking_level.name} #{t('batch')}" %> |
<% end %>
<% 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('studens_found')}" %>
<% end %>
<% else %>
<%= "#{t('no_text')} #{@ranking_level.name} #{t('studens_found')}" %>
<% end %>