Merge branch 'develop' into educoder

dev_haigong
cxt 6 years ago
commit 8640200398

@ -696,15 +696,16 @@ class EcCoursesController < ApplicationController
# 毕业要求指标点达成评价 # 毕业要求指标点达成评价
total_rate = [] total_rate = []
total_arry = EcCourseStudentScore.find_by_sql("SELECT avg(score) as averge_score, ec_target_position as position, 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 ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect where
where esst.ec_course_target_id=ect.id group by ec_course_target_id") esst.ec_course_target_id=ect.id and ect.ec_course_id = #{course_id}
group by ec_course_target_id")
all_score = 0 all_score = 0
total_arry.try(:each) do |ta| 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}") logger.info("##############total_rate: #{total_rate.to_json}")
all_score += ta.averge_score * ta.weigths all_score += ta.averge_score * ta.weigths
end 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 = 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| ecg_targets.chunk{|c| c.ec_graduation_subitem_id}.try(:each) do |key, egs_t|

Loading…
Cancel
Save