From cc7b52e345b8028a6f2ddf0649a5e991990d1ab7 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 30 Sep 2019 17:28:47 +0800 Subject: [PATCH] modify --- app/controllers/ecs/evaluations_controller.rb | 2 +- app/services/ecs/query_course_evaluation_service.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/ecs/evaluations_controller.rb b/app/controllers/ecs/evaluations_controller.rb index d801e13c4..09151132f 100644 --- a/app/controllers/ecs/evaluations_controller.rb +++ b/app/controllers/ecs/evaluations_controller.rb @@ -7,7 +7,7 @@ class Ecs::EvaluationsController < Ecs::CourseBaseController course_achievement: service.course_achievement, course_rate: service.course_rate, graduation_subitem_evaluations: service.graduation_subitem_evaluations, - score_levels_map: service.score_levels_map + score_levels: service.score_levels ) end diff --git a/app/services/ecs/query_course_evaluation_service.rb b/app/services/ecs/query_course_evaluation_service.rb index 3e23f260e..9b3587d78 100644 --- a/app/services/ecs/query_course_evaluation_service.rb +++ b/app/services/ecs/query_course_evaluation_service.rb @@ -65,10 +65,10 @@ class Ecs::QueryCourseEvaluationService < ApplicationService end end - def score_levels_map - @_score_levels_map ||= begin + def score_levels + @_score_levels ||= begin index = 0 - ec_course.ec_score_levels.each_with_object({}) do |level, obj| + ec_course.ec_score_levels.map do |level| hash = level.as_json(only: %i[id position score level]) hash[:description] = @@ -79,7 +79,7 @@ class Ecs::QueryCourseEvaluationService < ApplicationService end index += 1 - obj[level.id.to_s] = hash + hash end end end