dev_ec
p31729568 5 years ago
parent 24b7257031
commit 2b01e941d3

@ -5,6 +5,7 @@ class Ecs::EvaluationsController < Ecs::CourseBaseController
render_ok(
course_targets: service.course_targets,
course_achievement: service.course_achievement,
course_rate: service.course_rate,
graduation_subitem_evaluations: service.graduation_subitem_evaluations,
score_levels_map: service.score_levels_map
)

@ -4,6 +4,7 @@ class Ecs::QueryCourseEvaluationService < ApplicationService
def initialize(ec_course)
@ec_course = ec_course
@_course_achievement = 0
@_course_rate = 0
end
def course_targets
@ -16,6 +17,12 @@ class Ecs::QueryCourseEvaluationService < ApplicationService
@_course_achievement.round(2)
end
def course_rate
course_targets
@_course_rate.round(2)
end
def graduation_subitem_evaluations
student_scores = ec_course.ec_course_student_scores.joins(ec_student_score_targets: :ec_course_target).group(:ec_course_target_id)
student_scores = student_scores.select('AVG(score) as average_score, ec_course_target_id')
@ -96,6 +103,7 @@ class Ecs::QueryCourseEvaluationService < ApplicationService
# 计算总评成绩
@_course_achievement += data[:average_score].to_f * course_target.weight.to_f
@_course_rate += course_target.weight.to_f
# 计算学生成绩分布区间
student_count = 0

@ -7,7 +7,7 @@
<th width="14%" class="text-left">单位名称</th>
<th width="6%">地区</th>
<th width="6%">城市</th>
<th width="16%">详细地址</th>
<th width="16%" class="text-left">详细地址</th>
<th width="6%"><%= sort_tag('用户数', name: 'users_count', path: admins_schools_path) %></th>
<th width="6%">部门数</th>
<th width="12%"><%= sort_tag('创建时间', name: 'created_at', path: admins_schools_path) %></th>

Loading…
Cancel
Save