<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. -%>


<%#*<div id="register">%>
<%# this_user = User.find(session[:user_id]) if session[:user_id] %>
<%# unless this_user.student? or this_user.parent? %>
<%#*<div class="header">%>
<%#*<div class="month">%>
<%#= @student.full_name %>
<%#*</div>%>
<%#*<div class="extender"></div>%>
<%#*</div>%>
<%# end%>
<%#*</div>%>
<% grade_type = "normal" %>
<% grade_type = "GPA" if @batch.gpa_enabled? %>
<% grade_type = "CWA" if @batch.cwa_enabled? %>
<% if @type=="grouped" %>
  <div id="score-table">
    <div class="custom_header">
      <span class="student"><%= "#{@student.full_name} - #{@student.admission_no}" %></span>
    </div>
    <table id="listing" width="100%">
      <tr class="tr-head">
        <td><%= t('subject') %></td>
        <% if grade_type=="GPA" or grade_type=="CWA" %>
          <td><%= t('credit') %></td>
        <% end %>
        <% @exam_groups.each do |exam_group| %>
          <td><%= exam_group.name %></td>
        <% end %>
        <td><%= t('combined') %></td>
      </tr>
      <% @subjects.each do |subject| %>
        <tr class="tr-<%= cycle('odd', 'even') %>">
          <td class="col-2" ><%= subject.name %></td>
          <% if grade_type=="GPA" or grade_type=="CWA" %>
            <td class="col-3"><%= subject.credit_hours.present? ? subject.credit_hours : "-" %></td>
          <% end %>
          <% @exam_groups.each do |exam_group| %>

            <% @exam = Exam.find_by_subject_id_and_exam_group_id(subject.id,exam_group.id) %>
            <% exam_score = ExamScore.find_by_student_id(@student.id, :conditions=>{:exam_id=>@exam.id})unless @exam.nil? %>
            <td class="col-3">
              <% if grade_type=="GPA" %>
                <%= exam_score.present? ? "#{exam_score.grading_level || "-"}"+" ["+"#{exam_score.grading_level.present? ? (exam_score.grading_level.credit_points || "-") : "-"}"+"]" : "-" %>
              <% elsif grade_type=="CWA" %>
                <%= exam_score.present? ? "#{exam_score.marks.present? ? ("%.2f" %((exam_score.marks.to_f/@exam.maximum_marks.to_f)*100)) : "-"}"+" ["+"#{exam_score.grading_level.present? ? exam_score.grading_level : "-"}"+"]" : "-" %>
              <% else %>
                <% if exam_group.exam_type == "MarksAndGrades" %>
                  <%= exam_score.nil? ? '-' :  "#{(exam_score.marks || "-")}" +"/"+@exam.maximum_marks.to_s+"[#{(exam_score.grading_level || "-")}]" %>
                <% elsif exam_group.exam_type == "Marks" %>
                  <%= exam_score.nil? ? '-' : "#{exam_score.marks || "-"}/"+@exam.maximum_marks.to_s %>
                <% else %>
                  <%= exam_score.nil? ? '-' : (exam_score.grading_level || '-')  %>
                <% end %>
              <% end %>
            </td>
          <% end %>
          <% subject_average = GroupedExamReport.find_by_student_id_and_subject_id_and_score_type(@student.id,subject.id,"s") %>
          <td class="col-3"><%= subject_average.present? ? subject_average.marks : "-" %></td>
        </tr>
      <% end %>
      <tr class="tr-blank"></tr>
      <tr class="tr-head">
        <% if grade_type=="GPA" %>
          <td colspan="2" align="right"><%= t('gpa') %></td>
        <% elsif grade_type=="CWA" %>
          <td colspan="2" align="right"><%= t('weighted_average') %></td>
        <% else %>
          <td align="right"><%= t('percentage') %></td>
        <% end %>
        <% @exam_groups.each do |exam_group| %>
          <% exam_total = GroupedExamReport.find_by_student_id_and_exam_group_id_and_score_type(@student.id,exam_group.id,"e") %>
          <td class="col-3">
            <%= exam_total.present? ? exam_total.marks : "-" %>
          </td>
        <% end %>
        <% total_avg = GroupedExamReport.find_by_student_id_and_batch_id_and_score_type(@student.id,@batch.id,"c") %>
        <td class="col-3"><%= total_avg.present? ? total_avg.marks : "-" %></td>
      </tr>
    </table>
  </div>
<% else %>
 <% all_exams = @exam_groups.reject{|ex| ex.exam_type == "Grades"} %>
  <div id="score-table">
    <table id="listing" width="100%">
      <div class="custom_header">
        <span class="student"><%= "#{@student.full_name} - #{@student.admission_no}" %></span>
      </div>
      <tr class="tr-head">
        <td><%= t('subject') %></td>
        <% @exam_groups.each do |exam_group| %>
          <td><%= exam_group.name %></td>
        <% end %>
        <% unless all_exams.empty? %>
          <td><%= t('total') %></td>
        <% end %>
      </tr>
      <% @subjects.each do |subject| %>
        <tr class="tr-<%= cycle('odd', 'even') %>">
          <td class="col-2" ><%= subject.name %></td>
          <% @mmg = 1;@g = 1 %>

          <% @exam_groups.each do |exam_group| %>

            <% @exam = Exam.find_by_subject_id_and_exam_group_id(subject.id,exam_group.id) %>
            <% exam_score = ExamScore.find_by_student_id(@student.id, :conditions=>{:exam_id=>@exam.id})unless @exam.nil? %>
            <td class="col-3">
              <% unless @exam.nil? %>
                <% if exam_group.exam_type == "MarksAndGrades" %>
                  <%= exam_score.nil? ? '-' :  "#{(exam_score.marks || "-")}" +"/"+@exam.maximum_marks.to_s+"[#{(exam_score.grading_level || "-")}]" %>
                <% elsif exam_group.exam_type == "Marks" %>
                  <%= exam_score.nil? ? '-' : "#{exam_score.marks || "-"}/"+@exam.maximum_marks.to_s %>
                <% else %>
                  <%= exam_score.nil? ? '-' : (exam_score.grading_level || '-')  %>
                  <% @g = 0 %>
                <% end %>
              <% else %>
                <%= "#{t('n_a')}" %>
              <% end %>
            <% end %>
          </td>
          <% total_score = ExamScore.new() %>
          <% unless all_exams.empty? %>
            <% if @mmg == @g %>
              <td class="col-1"><%= total_score.grouped_exam_subject_total(subject,@student,@type) %></td>
            <% else %>
              <td class="col-1">-</td>
            <% end %>
          <% end %>
        </tr>

      <% end %>
      <tr class="tr-head">
        <td><%= t('total') %></td>
        <% @max_total = 0 %>
        <% @marks_total = 0 %>

        <% @exam_groups.each do |exam_group| %>
          <% if exam_group.exam_type == "MarksAndGrades" %>
            <td><%= exam_group.total_marks(@student)[0] %></td>
          <% elsif exam_group.exam_type == "Marks" %>
            <td><%= exam_group.total_marks(@student)[0] %></td>
          <% else %>
            <td>-</td>
          <% end %>
          <% unless exam_group.exam_type == "Grades" %>
            <% @max_total = @max_total + exam_group.total_marks(@student)[1] %>
            <% @marks_total = @marks_total + exam_group.total_marks(@student)[0] %>
          <% end %>
        <% end %>
        <% unless all_exams.empty? %>
          <td></td>
        <% end %>
      </tr>
      <tr></tr>
    </table>
    <% if @mmg == @g %>
      <div class="custom_header">
        <% percentage = (@marks_total*100/@max_total.to_f)  unless @max_total==0 %>
        <%= t('total_marks') %> = <%= @marks_total %> | <%= t('aggregate') %> % = <%= "%.2f" %percentage  unless percentage.nil?%>
      </div>
    <% end %>
  </div>
<% end %>
<% if @previous_batch == 1 %>
<%= link_to " ► #{t('pdf_report')}",
  { :action => "generated_report4_pdf", :batch_id => @batch.id, :student=>@student.id, :type=> @type},:target => '_blank', :class=> 'user_button1' %>
<% else %>
<%= link_to " ► #{t('pdf_report')}",
  { :action => "generated_report4_pdf", :batch_id => @batch.id, :student=>@student.id, :type=> @type},:target => '_blank', :class=> 'user_button' %>
<% end %>
<div class="extender"></div><commit_msg>theme style issue fix in exam<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. -%>


<%#*<div id="register">%>
<%# this_user = User.find(session[:user_id]) if session[:user_id] %>
<%# unless this_user.student? or this_user.parent? %>
<%#*<div class="header">%>
<%#*<div class="month">%>
<%#= @student.full_name %>
<%#*</div>%>
<%#*<div class="extender"></div>%>
<%#*</div>%>
<%# end%>
<%#*</div>%>
<% grade_type = "normal" %>
<% grade_type = "GPA" if @batch.gpa_enabled? %>
<% grade_type = "CWA" if @batch.cwa_enabled? %>
<% if @type=="grouped" %>
  <div id="score-table">
    <div class="custom_header">
      <span class="student"><%= "#{@student.full_name} - #{@student.admission_no}" %></span>
    </div>
    <table id="listing" width="100%">
      <tr class="tr-head">
        <td><%= t('subject') %></td>
        <% if grade_type=="GPA" or grade_type=="CWA" %>
          <td><%= t('credit') %></td>
        <% end %>
        <% @exam_groups.each do |exam_group| %>
          <td><%= exam_group.name %></td>
        <% end %>
        <td><%= t('combined') %></td>
      </tr>
      <% @subjects.each do |subject| %>
        <tr class="tr-<%= cycle('odd', 'even') %>">
          <td class="col-2" ><%= subject.name %></td>
          <% if grade_type=="GPA" or grade_type=="CWA" %>
            <td class="col-3"><%= subject.credit_hours.present? ? subject.credit_hours : "-" %></td>
          <% end %>
          <% @exam_groups.each do |exam_group| %>

            <% @exam = Exam.find_by_subject_id_and_exam_group_id(subject.id,exam_group.id) %>
            <% exam_score = ExamScore.find_by_student_id(@student.id, :conditions=>{:exam_id=>@exam.id})unless @exam.nil? %>
            <td class="col-3">
              <% if grade_type=="GPA" %>
                <%= exam_score.present? ? "#{exam_score.grading_level || "-"}"+" ["+"#{exam_score.grading_level.present? ? (exam_score.grading_level.credit_points || "-") : "-"}"+"]" : "-" %>
              <% elsif grade_type=="CWA" %>
                <%= exam_score.present? ? "#{exam_score.marks.present? ? ("%.2f" %((exam_score.marks.to_f/@exam.maximum_marks.to_f)*100)) : "-"}"+" ["+"#{exam_score.grading_level.present? ? exam_score.grading_level : "-"}"+"]" : "-" %>
              <% else %>
                <% if exam_group.exam_type == "MarksAndGrades" %>
                  <%= exam_score.nil? ? '-' :  "#{(exam_score.marks || "-")}" +"/"+@exam.maximum_marks.to_s+"[#{(exam_score.grading_level || "-")}]" %>
                <% elsif exam_group.exam_type == "Marks" %>
                  <%= exam_score.nil? ? '-' : "#{exam_score.marks || "-"}/"+@exam.maximum_marks.to_s %>
                <% else %>
                  <%= exam_score.nil? ? '-' : (exam_score.grading_level || '-')  %>
                <% end %>
              <% end %>
            </td>
          <% end %>
          <% subject_average = GroupedExamReport.find_by_student_id_and_subject_id_and_score_type(@student.id,subject.id,"s") %>
          <td class="col-3"><%= subject_average.present? ? subject_average.marks : "-" %></td>
        </tr>
      <% end %>
      <tr class="tr-blank"></tr>
      <tr class="tr-head">
        <% if grade_type=="GPA" %>
          <td colspan="2" align="right"><%= t('gpa') %></td>
        <% elsif grade_type=="CWA" %>
          <td colspan="2" align="right"><%= t('weighted_average') %></td>
        <% else %>
          <td align="right"><%= t('percentage') %></td>
        <% end %>
        <% @exam_groups.each do |exam_group| %>
          <% exam_total = GroupedExamReport.find_by_student_id_and_exam_group_id_and_score_type(@student.id,exam_group.id,"e") %>
          <td class="col-3">
            <%= exam_total.present? ? exam_total.marks : "-" %>
          </td>
        <% end %>
        <% total_avg = GroupedExamReport.find_by_student_id_and_batch_id_and_score_type(@student.id,@batch.id,"c") %>
        <td class="col-3"><%= total_avg.present? ? total_avg.marks : "-" %></td>
      </tr>
    </table>
  </div>
<% else %>
 <% all_exams = @exam_groups.reject{|ex| ex.exam_type == "Grades"} %>
  <div id="score-table">
    <table id="listing" width="100%">
      <div class="custom_header">
        <span class="student"><%= "#{@student.full_name} - #{@student.admission_no}" %></span>
      </div>
      <tr class="tr-head">
        <td><%= t('subject') %></td>
        <% @exam_groups.each do |exam_group| %>
          <td><%= exam_group.name %></td>
        <% end %>
        <% unless all_exams.empty? %>
          <td><%= t('total') %></td>
        <% end %>
      </tr>
      <% @subjects.each do |subject| %>
        <tr class="tr-<%= cycle('odd', 'even') %>">
          <td class="col-2" ><%= subject.name %></td>
          <% @mmg = 1;@g = 1 %>

          <% @exam_groups.each do |exam_group| %>

            <% @exam = Exam.find_by_subject_id_and_exam_group_id(subject.id,exam_group.id) %>
            <% exam_score = ExamScore.find_by_student_id(@student.id, :conditions=>{:exam_id=>@exam.id})unless @exam.nil? %>
            <td class="col-3">
              <% unless @exam.nil? %>
                <% if exam_group.exam_type == "MarksAndGrades" %>
                  <%= exam_score.nil? ? '-' :  "#{(exam_score.marks || "-")}" +"/"+@exam.maximum_marks.to_s+"[#{(exam_score.grading_level || "-")}]" %>
                <% elsif exam_group.exam_type == "Marks" %>
                  <%= exam_score.nil? ? '-' : "#{exam_score.marks || "-"}/"+@exam.maximum_marks.to_s %>
                <% else %>
                  <%= exam_score.nil? ? '-' : (exam_score.grading_level || '-')  %>
                  <% @g = 0 %>
                <% end %>
              <% else %>
                <%= "#{t('n_a')}" %>
              <% end %>
            <% end %>
          </td>
          <% total_score = ExamScore.new() %>
          <% unless all_exams.empty? %>
            <% if @mmg == @g %>
              <td class="col-1"><%= total_score.grouped_exam_subject_total(subject,@student,@type) %></td>
            <% else %>
              <td class="col-1">-</td>
            <% end %>
          <% end %>
        </tr>

      <% end %>
      <tr class="tr-head">
        <td><%= t('total') %></td>
        <% @max_total = 0 %>
        <% @marks_total = 0 %>

        <% @exam_groups.each do |exam_group| %>
          <% if exam_group.exam_type == "MarksAndGrades" %>
            <td><%= exam_group.total_marks(@student)[0] %></td>
          <% elsif exam_group.exam_type == "Marks" %>
            <td><%= exam_group.total_marks(@student)[0] %></td>
          <% else %>
            <td>-</td>
          <% end %>
          <% unless exam_group.exam_type == "Grades" %>
            <% @max_total = @max_total + exam_group.total_marks(@student)[1] %>
            <% @marks_total = @marks_total + exam_group.total_marks(@student)[0] %>
          <% end %>
        <% end %>
        <% unless all_exams.empty? %>
          <td></td>
        <% end %>
      </tr>
      <tr></tr>
    </table>
    <% if @mmg == @g %>
      <div class="custom_header">
        <% percentage = (@marks_total*100/@max_total.to_f)  unless @max_total==0 %>
        <%= t('total_marks') %> = <%= @marks_total %> | <%= t('aggregate') %> % = <%= "%.2f" %percentage  unless percentage.nil?%>
      </div>
    <% end %>
  </div>
<% end %>
<% if @previous_batch == 1 %>
<%= link_to " ► #{t('pdf_report')}",
  { :action => "generated_report4_pdf", :batch_id => @batch.id, :student=>@student.id, :type=> @type},:target => '_blank', :class=> 'user_button' %>
<% else %>
<%= link_to " ► #{t('pdf_report')}",
  { :action => "generated_report4_pdf", :batch_id => @batch.id, :student=>@student.id, :type=> @type},:target => '_blank', :class=> 'user_button' %>
<% end %>
<div class="extender"></div>
{'fraction_non_alphanumeric': 0.22029747326921928, 'fraction_numerical': 0.005674690878681082, 'mean_word_length': 2.422322158626329, 'pattern_counts': {'":': 0, '<': 455, '<?xml version=': 0, '>': 487, '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': '2124519', 'n_tokens_mistral': 6404, 'n_tokens_neox': 5815, 'n_words': 980}