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

<%= "Grouped Exam Report for Batch : "+@batch.full_name %>

<% grade_type = "normal" %> <% grade_type = "GPA" if @batch.gpa_enabled? %> <% grade_type = "CWA" if @batch.cwa_enabled? %> <% @students.each_with_index do |student,i| %> <% general_subjects = Subject.find_all_by_batch_id(@batch.id, :conditions=>"elective_group_id IS NULL and is_deleted=false") %> <% student_electives = StudentsSubject.find_all_by_student_id(student.id,:conditions=>"batch_id = #{@batch.id}") %> <% elective_subjects = [] %> <% student_electives.each do |elect| %> <% elective_subjects.push Subject.find(elect.subject_id,:conditions => {:is_deleted => false}) %> <% end %> <% @subjects = general_subjects + elective_subjects %> <% @subjects.reject!{|s| s.no_exams==true} %> <% exams = Exam.find_all_by_exam_group_id(@exam_groups.collect(&:id)) %> <% subject_ids = exams.collect(&:subject_id) %> <% @subjects.reject!{|sub| !(subject_ids.include?(sub.id))} %>
<% if i == 0 %>
<% else %>
<% end %>

<%= student.full_name %>

<% if @type=="grouped" %> <% if grade_type=="GPA" or grade_type=="CWA" %> <% end %> <% @exam_groups.each do |exam_group| %> <% end %> <% c ='even' %> <% @subjects.each do |subject| %> "> <% if grade_type=="GPA" or grade_type=="CWA" %> <% 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? %> <% end %> <% subject_average = GroupedExamReport.find_by_student_id_and_subject_id_and_score_type(student.id,subject.id,"s") %> <% end %> <% if grade_type=="GPA" %> <% elsif grade_type=="CWA" %> <% else %> <% 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") %> <% end %> <% total_avg = GroupedExamReport.find_by_student_id_and_batch_id_and_score_type(student.id,student.batch.id,"c") %>
<%= t('subject') %><%= t('credit') %><%= exam_group.name %><%= t('combined') %>
<%= subject.name %><%= subject.credit_hours.present? ? subject.credit_hours : "-" %> <% 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 %> <%= subject_average.present? ? subject_average.marks : "-" %>
<%= t('gpa') %><%= t('weighted_average') %><%= t('percentage') %> <%= exam_total.present? ? exam_total.marks : "-" %> <%= total_avg.present? ? total_avg.marks : "-" %>
<% else %> <% all_exams = @exam_groups.reject{|ex| ex.exam_type == "Grades"} %> <% @exam_groups.each do |exam_group| %> <% end %> <% unless all_exams.empty? %> <% end %> <% c ='even' %> <% @subjects.each do |subject| %> "> <% @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? %> <% total_score = ExamScore.new() %> <% unless all_exams.empty? %> <% if @mmg == @g %> <% else %> <% end %> <% end %> <% end %> "> <% @max_total = 0 %> <% @marks_total = 0 %> <% @exam_groups.each do |exam_group| %> <% if exam_group.exam_type == "MarksAndGrades" %> <% elsif exam_group.exam_type == "Marks" %> <% else %> <% 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? %> <% end %>
<%= t('subject') %><%= exam_group.name %><%= t('total') %>
<%= subject.name %> <% 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 %> <%= total_score.grouped_exam_subject_total(subject,student,@type) %>-
<%= t('total') %><%= exam_group.total_marks(student)[0] %><%= exam_group.total_marks(student)[0] %>-
<% end %>
<% end %>