dev_local
cxt 6 years ago
parent d987a10746
commit d5cdca31c9

@ -949,6 +949,20 @@ class AccountController < ApplicationController
if @se.identity == 0 && @user.certification == 1
join_ex_course @user
end
if @user.certification != 1 && @se.identity == 1
school_ids = School.where(:auto_users_trial => 1).map(&:id)
# 授权单位中的只有学生身份才自动授权,且创建试用授权记录
if !@se.school.nil? && school_ids.include?(@se.school_id)
@user.update_attributes(:certification => 1)
apply_action = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization", :status => 0).first
if apply_action.present?
apply_action.update_attributes(:status => 1, :noticed => 1)
else
ApplyAction.create(:user_id => @user.id, :container_type => "TrialAuthorization", :ip_addr => request.remote_ip, :status => 1, :noticed => 1)
end
end
end
end
redirect_to my_account_path
end

@ -1375,6 +1375,8 @@ class ExerciseController < ApplicationController
@exercise.exercise_users.where(:user_id => params[:user_id]).update_all(:score => nil, :start_at => nil, :end_at => nil, :status => nil, :commit_status => 0, :objective_score => -1, :subjective_score => -1)
ExerciseAnswer.where(:user_id => params[:user_id], :exercise_question_id => @exercise.exercise_questions.pluck(:id)).destroy_all
ExerciseShixunAnswer.where(:user_id => params[:user_id], :exercise_question_id => @exercise.exercise_questions.pluck(:id)).destroy_all
ExerciseUserQuestion.where(:exercise_id => @exercise.id, :exercise_user_id =>
@exercise.exercise_users.where(:user_id => params[:user_id]).pluck(:id)).destroy_all
end
redirect_to student_exercise_list_exercise_path(@exercise)
end

Loading…
Cancel
Save