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

dev_course
cxt 5 years ago
commit fb65f88ebf

@ -23,8 +23,8 @@ class FilesController < ApplicationController
get_category(@course, course_second_category_id)
@total_count = @attachments.size
@public_count = @attachments.publiced.size
@private_count = @total_count - @public_count
@publish_count = @attachments.published.size
@unpublish_count = @total_count - @publish_count
@attachments = @attachments.by_keywords(params[:search])
@attachments =

@ -17,7 +17,7 @@ class MyshixunsController < ApplicationController
# 强制重置实训
# 前段需要按照操作过程提示
def reset_my_game
unless current_user.admin?
unless (current_user.admin? || current_user.id == @myshixun.user_id)
tip_exception("403", "")
end

@ -524,8 +524,13 @@ class ShixunsController < ApplicationController
# 如果存在实训,则直接进入实训
# 如果实训允许跳关传参params[:challenge_id]跳入具体的关卡
@current_task =
if params[:challenge_id] && @shixun.task_pass
games.where(challenge_id: params[:challenge_id]).take
if params[:challenge_id]
game = games.where(challenge_id: params[:challenge_id]).take
if @shixun.task_pass || game.status != 3
game
else
current_myshixun.current_task(games)
end
else
current_myshixun.current_task(games)
end

@ -76,8 +76,9 @@ class Challenge < ApplicationRecord
## 用户关卡状态 0: 不能开启实训; 1:直接开启; 2表示已完成
def user_tpi_status user_id
# todo: 以前没加索引导致相同关卡,同一用户有多个games
game = games.last
# 允许跳关则直接开启
return 1 if shixun.task_pass
game = games.where(user_id: user_id).take
if game.blank?
self.position == 1 ? 1 : 0
elsif game.status == 2

@ -3,8 +3,8 @@ json.data do
json.id @category_id
json.name @category_name
json.total_count @total_count
json.public_count @public_count
json.private_count @private_count
json.publish_count @publish_count
json.unpublish_count @unpublish_count
json.course_is_public @course.is_public?
json.files do
json.array! @attachments do |attachment|

Loading…
Cancel
Save