Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_course
SylorHuang 6 years ago
commit d72110f9a2

@ -128,7 +128,7 @@ module ApplicationHelper
if source.class.to_s == 'User' if source.class.to_s == 'User'
File.join(relative_path, ["#{source.class}", "#{source.id}"]) File.join(relative_path, ["#{source.class}", "#{source.id}"])
else else
File.join("/images/avatars", ["#{source.class}", "#{source.id}"]) File.join("images/avatars", ["#{source.class}", "#{source.id}"])
end end
elsif source.class.to_s == 'User' elsif source.class.to_s == 'User'
str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g" str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g"
@ -146,7 +146,7 @@ module ApplicationHelper
def shixun_url_to_avatar(shixun) def shixun_url_to_avatar(shixun)
if File.exist?(disk_filename(shixun.class, shixun.id)) if File.exist?(disk_filename(shixun.class, shixun.id))
File.join("/images/#{relative_path}", "#{shixun.class}", "#{shixun.id}") File.join("images/#{relative_path}", "#{shixun.class}", "#{shixun.id}")
else else
File.join("educoder", "index", "shixun", "shixun#{rand(23)}.jpg") File.join("educoder", "index", "shixun", "shixun#{rand(23)}.jpg")
end end

@ -111,7 +111,7 @@ class HomeworksService
if homework.work_efficiency if homework.work_efficiency
if homework.max_efficiency < student_work.efficiency if homework.max_efficiency < student_work.efficiency
# homework.max_efficiency = student_work.efficiency # homework.max_efficiency = student_work.efficiency
homework.update_column("max_efficiency", homework.max_efficiency) homework.update_column("max_efficiency", student_work.efficiency)
end end
# eff_score = homework.max_efficiency == 0 ? 0 : student_work.efficiency / homework.max_efficiency * homework.eff_score # eff_score = homework.max_efficiency == 0 ? 0 : student_work.efficiency / homework.max_efficiency * homework.eff_score
# student_work.eff_score = format("%.2f", eff_score) # student_work.eff_score = format("%.2f", eff_score)
@ -200,7 +200,7 @@ class HomeworksService
# 如果作业的最大效率值有变更则更新所有作品的效率分 # 如果作业的最大效率值有变更则更新所有作品的效率分
if homework.work_efficiency && homework.max_efficiency < work.efficiency if homework.work_efficiency && homework.max_efficiency < work.efficiency
homework.update_column("max_efficiency", homework.max_efficiency) homework.update_column("max_efficiency", work.efficiency)
end end
end end

@ -15,6 +15,7 @@ json.efficiency number_with_precision @work.efficiency, precision: 2
json.max_efficiency number_with_precision @homework.max_efficiency, precision: 2 json.max_efficiency number_with_precision @homework.max_efficiency, precision: 2
json.passed_time @myshixun.passed_time json.passed_time @myshixun.passed_time
json.total_spend_time @myshixun.total_spend_time json.total_spend_time @myshixun.total_spend_time
json.user_score @myshixun.total_score
# 关卡完成情况 # 关卡完成情况
index = 1 index = 1

Loading…
Cancel
Save