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