app/models/activities/accountability_report.rb
def service_learning_course_statistics(department, force = false)
    ACCOUNTABILITY_CACHE.fetch("accountability_report_#{self.id}_for_department_#{department.dept_code}_stats", :expires_in => 24.hours) do
      load_results(:with_departments, force) if force || @results.empty?
      stats = {:department => {}}
            
      for system_key, quarter_hash in @results
        for quarter_abbrev, activities in quarter_hash
        
          for activity in activities       
              klass, id = activity[:activity].split("_")
              a = klass.constantize.find(id) rescue nil
            
              department_id, department_name = activity[:department].split("_")
            
              if a.is_a?(ServiceLearningPlacement) && department_id.to_i == department.dept_code
                unless stats[:department][activity[:department]]
                  stats[:department][activity[:department]] = { :quarters => {} }
                  for quarter in @quarters
                    stats[:department][activity[:department]][:quarters][quarter.abbrev] = { :courses => {} }
                  end
                end
              
                unless activity[:course].blank?                
                  if stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses].include?(activity[:course])
                     stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses][activity[:course]] += 1
                  else
                    stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses][activity[:course]] = 1
                  end                                               
                end
                               
              end                  
          end  
                                               
        end
      end    
      stats
    end
  end
# Calculates the totals by courses for all ServiceLearningPlacement in the data hash. Display this information in reporting course in accountability
Calculates the totals by courses for all ServiceLearningPlacement in the data hash. Display this information in reporting course in accountability
Calculates the totals by courses for all ServiceLearningPlacement in the data hash . Display this information in reporting course in accountability
def service_learning_course_statistics(department, force = false)
    ACCOUNTABILITY_CACHE.fetch("accountability_report_#{self.id}_for_department_#{department.dept_code}_stats", :expires_in => 24.hours) do
      load_results(:with_departments, force) if force || @results.empty?
      stats = {:department => {}}
      for system_key, quarter_hash in @results
        for quarter_abbrev, activities in quarter_hash
          for activity in activities       
              klass, id = activity[:activity].split("_")
              a = klass.constantize.find(id) rescue nil
              department_id, department_name = activity[:department].split("_")
              if a.is_a?(ServiceLearningPlacement) && department_id.to_i == department.dept_code
                unless stats[:department][activity[:department]]
                  stats[:department][activity[:department]] = { :quarters => {} }
                  for quarter in @quarters
                    stats[:department][activity[:department]][:quarters][quarter.abbrev] = { :courses => {} }
                  end
                end
                unless activity[:course].blank?                
                  if stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses].include?(activity[:course])
                     stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses][activity[:course]] += 1
                  else
                    stats[:department][activity[:department]][:quarters][quarter_abbrev][:courses][activity[:course]] = 1
                  end                                               
                end
              end                  
          end  
        end
      end    
      stats
    end
  end
def service_learning_course_statistics ( department , force = false ) ACCOUNTABILITY_CACHE . fetch ( "accountability_report_#{self.id}_for_department_#{department.dept_code}_stats" , :expires_in => 24 . hours ) do load_results ( :with_departments , force ) if force || @results . empty? stats = { :department => { } } for system_key , quarter_hash in @results for quarter_abbrev , activities in quarter_hash for activity in activities klass , id = activity [ :activity ] . split ( "_" ) a = klass . constantize . find ( id ) rescue nil department_id , department_name = activity [ :department ] . split ( "_" ) if a . is_a? ( ServiceLearningPlacement ) && department_id . to_i == department . dept_code unless stats [ :department ] [ activity [ :department ] ] stats [ :department ] [ activity [ :department ] ] = { :quarters => { } } for quarter in @quarters stats [ :department ] [ activity [ :department ] ] [ :quarters ] [ quarter . abbrev ] = { :courses => { } } end end unless activity [ :course ] . blank? if stats [ :department ] [ activity [ :department ] ] [ :quarters ] [ quarter_abbrev ] [ :courses ] . include? ( activity [ :course ] ) stats [ :department ] [ activity [ :department ] ] [ :quarters ] [ quarter_abbrev ] [ :courses ] [ activity [ :course ] ] += 1 else stats [ :department ] [ activity [ :department ] ] [ :quarters ] [ quarter_abbrev ] [ :courses ] [ activity [ :course ] ] = 1 end end end end end end stats end end
Calculates the totals by courses for all ServiceLearningPlacement in the data hash.
Calculates the totals by courses for all ServiceLearningPlacement in the data hash .
department
force