diff --git a/app/controllers/ec_courses_controller.rb b/app/controllers/ec_courses_controller.rb index ae02ea2b..df8c24b8 100644 --- a/app/controllers/ec_courses_controller.rb +++ b/app/controllers/ec_courses_controller.rb @@ -696,15 +696,16 @@ class EcCoursesController < ApplicationController # 毕业要求指标点达成评价 total_rate = [] total_arry = EcCourseStudentScore.find_by_sql("SELECT avg(score) as averge_score, ec_target_position as position, - ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect - where esst.ec_course_target_id=ect.id group by ec_course_target_id") + ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect where + esst.ec_course_target_id=ect.id and ect.ec_course_id = #{course_id} + group by ec_course_target_id") all_score = 0 total_arry.try(:each) do |ta| - total_rate << {:position => ta.position, :score => ta.averge_score.round(1), :rate => ta.weigths} + total_rate << {:position => ta.position, :score => ta.averge_score.round(2), :rate => ta.weigths} logger.info("##############total_rate: #{total_rate.to_json}") all_score += ta.averge_score * ta.weigths end - total_rate << {:total_score => (all_score).round(1)} + total_rate << {:total_score => (all_score).round(2)} ecg_targets = EcGraduationSubitemCourseTarget.where(:ec_course_target_id => @ec_course.ec_course_targets) ecg_targets.chunk{|c| c.ec_graduation_subitem_id}.try(:each) do |key, egs_t|