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

dev_home
杨树林 5 years ago
commit 7c846c37e6

@ -180,17 +180,19 @@ module ExercisesHelper
elsif ex.question_type == Exercise::COMPLETION #填空题
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text
null_stand_text = null_standard_answer.pluck(:answer_text)
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0
null_stand_choice.each_with_index do |s,index|
user_count = 0
s_choice_text = null_stand_text[index]
if ex_ordered #有序排列
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
else
null_stand_text = null_stand_text.uniq
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
end
@ -211,7 +213,7 @@ module ExercisesHelper
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
user_wrong_count = (effictive_users_count - all_user_count )
user_wrong_count = (effictive_users_count - all_user_count)
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)

@ -12,7 +12,7 @@ module MyshixunsHelper
end
end
def view_answer_time game, user_id
game.game_answers.where(user_id: user_id).last&.view_time
def view_answer_time game
game.game_answers.where(user_id: game.user_id).last&.view_time
end
end

@ -6,6 +6,6 @@ json.array! @games do |game|
json.identifier get_game_identifier(@shixun.task_pass, game, @identity)
json.get_gold game.user_get_gold_and_experience(@shixun.status, challenge)[0]
json.get_experience game.user_get_gold_and_experience(@shixun.status, challenge)[1]
json.view_answer_time view_answer_time(game, current_user.id)
json.view_answer_time view_answer_time(game)
json.finished_time game.end_time
end

@ -0,0 +1,24 @@
class MigrateGccProjectTeam < ActiveRecord::Migration[5.2]
def change
competition = Competition.find_by(id: 8)
if competition
competition.competition_teams.destroy_all
all_login = [['mu2pwryse', 'pljq3f9xp', 'pfx7gfmiz'], ['p9rs7xtfl', 'prx72s8uc', 'plezci23p', 'pjysrikw7'], ['m40352189', 'p05394287'],
['m9ozhx83t', 'p05296348'], ['p35490268', 'p48921607', 'p24019738'], ['p29165708', 'm43960821']]
all_login.each do |user_login|
leader = User.find_by!(login: user_login.first)
team = CompetitionTeam.create!(name: "#{leader.real_name}", user_id: leader.id, competition_id: 8)
team.generate_invite_code
team.save!
team.team_members.create!(user_id: leader.id, competition_id: competition.id, role: 1, is_teacher: 0)
user_login.each_with_index do |user_login, index|
if index > 0
user = User.find_by(login: user_login)
team.team_members.create!(user_id: user.id, competition_id: competition.id, role: 2, is_teacher: 0)
end
end
end
end
end
end

@ -305,7 +305,8 @@ class LeftViewContainer extends Component {
id: item.answer_id,
name: item.answer_name,
score: item.answer_score,
contents: item.answer_contents
contents: item.answer_contents,
view_time: item.view_time
}
})
newAnswers.forEach((item, index) => {
@ -558,7 +559,7 @@ class LeftViewContainer extends Component {
// /shixuns/mnf6b7z3/shixun_discuss?challenge_id=88
render() {
const { challenge } = this.props
const { tabIndex } = this.state;
const { tabIndex } = this.state;
return (
<React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

Loading…
Cancel
Save