count为空的情况

educoder
wangxu 3 years ago
parent 8ff3dc567b
commit fb978471d4

@ -229,7 +229,7 @@ class EcCourseAchievementMethodsController < ApplicationController
evaluation_subitems_list = [] evaluation_subitems_list = []
# 总成绩支撑只有课程考核标准的名称, 分项成绩支撑是课程考核标准名称与考核分项的笛卡尔积 # 总成绩支撑只有课程考核标准的名称, 分项成绩支撑是课程考核标准名称与考核分项的笛卡尔积
if e.status == 1 if e.status == 1
for k in 1..e.evluation_count for k in 1..(e.evluation_count || 1)
# id为-1 表示总成绩支撑没有id # id为-1 表示总成绩支撑没有id
evaluation_subitems_list << {id: -1, name: "#{e.name}#{k}", position: k} evaluation_subitems_list << {id: -1, name: "#{e.name}#{k}", position: k}
end end
@ -239,7 +239,7 @@ class EcCourseAchievementMethodsController < ApplicationController
evaluation_subitems_list << {id: ces.id, name: "#{ces.name}", position: j+1} evaluation_subitems_list << {id: ces.id, name: "#{ces.name}", position: j+1}
end end
else else
for k in 1..e.evluation_count for k in 1..(e.evluation_count || 1)
e.ec_course_evaluation_subitems.each_with_index do |ces, j| e.ec_course_evaluation_subitems.each_with_index do |ces, j|
evaluation_subitems_list << {id: ces.id, name: "#{e.name}#{k}:#{ces.name}", position: k} evaluation_subitems_list << {id: ces.id, name: "#{e.name}#{k}:#{ces.name}", position: k}
end end

Loading…
Cancel
Save