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

newyslclassrooms
cxt 5 years ago
commit 58fd792541

@ -155,10 +155,15 @@ class ChallengesController < ApplicationController
def index
uid_logger("identifier: #{params}")
bases_column = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position,
base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position,
challenges.shixun_id, games.identifier, games.status"
@challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id})
.select(bases_column)
# 下面2个参数是为了解决列表获取通关人数与正在游玩人数的问题
@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count
@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count
@challenges = @shixun.challenges.joins("left join games on games.challenge_id = challenges.id and games.user_id = #{current_user.id}")
.select(base_columns)
@editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员
@user = current_user
@shixun.increment!(:visits)

@ -16,8 +16,10 @@ if @challenges.present?
json.st challenge.st
json.name challenge.subject
json.score challenge.score
json.passed_count challenge.user_passed_count
json.playing_count challenge.playing_count
json.passed_count @pass_games_map.fetch(challenge.id, 0)
#json.passed_count challenge.user_passed_count
json.playing_count @play_games_map.fetch(challenge.id, 0)
#json.playing_count challenge.playing_count
json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
json.open_game challenge.open_game
if @editable

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -17,7 +17,6 @@ const initialState = {
commitTestRecordDetail: {}, // 调试代码执行结果
commitRecordDetail: {}, // 提交成功后记录提交的详情
commitRecord: [], // 提交记录
userCode: '', // 保存当前用户输入的代码
isUpdateCode: false, // 是否更新了代码内容
userCodeTab: 'task', // 学员测评tab位置: task | record | comment
userTestInput: '', // 用户自定义输入值
@ -59,7 +58,7 @@ const ojForUserReducer = (state = initialState, action) => {
hack: Object.assign({}, hack),
test_case: Object.assign({}, test_case),
comment_identifier: hack.identifier,
userCode: tempCode
editor_code: tempCode
}
case types.COMMIT_RECORD_DETAIL:
let result = action.payload.data;
@ -127,7 +126,8 @@ const ojForUserReducer = (state = initialState, action) => {
}
return {
...state,
recordDetail: tempDetail
recordDetail: tempDetail,
editor_code: tempDetail['code']
}
case types.RESTORE_INITIAL_CODE:
const curHack = state.hack;

Loading…
Cancel
Save