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

dev_forum
daiao 6 years ago
commit 2bf4ac7433

@ -83,7 +83,6 @@ class AccountsController < ApplicationController
email = params[:login]
verifi_code = VerificationCode.where(email: email, code: code, code_type: 3).last
user = User.find_by_mail(email) #这里有问题应该是为email,而不是mail 6.13-hs
end
check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60)
unless check_code

@ -1334,7 +1334,7 @@ class ExercisesController < ApplicationController
#导出空白试卷
def export_exercise
@exercise_questions = @exercise.exercise_questions.order("question_number ASC")
@exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC")
filename = "#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.current.strftime('%Y%m%d%H%M%S')}.pdf"
stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css"
render pdf: 'exercise_export/blank_exercise', filename: filename, stylesheets: stylesheets

@ -81,9 +81,8 @@ class ExerciseUserPdfService
@exercise_ques_shixun_count = exercise_ques_shixun.all.count
@exercise_ques_shixun_scores = exercise_ques_shixun.pluck(:question_score).sum
challenge_ids = @exercise_questions.joins(:exercise_shixun_challenges).pluck("exercise_shixun_challenges.challenge_id")
@exercise_questions = @exercise_questions.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers)
get_each_student_exercise(exercise.id,@exercise_questions,@ex_user_user.id)
@games = @exercise_user.user.games.ch_games(challenge_ids)
end
end

@ -156,7 +156,7 @@ p{
position: absolute;
display: inline-block;
bottom: 6px;
/*left: 1px;*/
left: 1px;
}
.line-line {
@ -231,7 +231,7 @@ p{
position: absolute;
display: inline-block;
bottom: 9px;
left: 1px;
left: 2px;
}
.circle-right:after{
color:#fff;

@ -112,6 +112,7 @@
<div class="mbt10">
<% @exercise_questions.each do |q| %>
<% q_type = q.question_type %>
<% games =( q_type == 5 ? @ex_user_user.games.ch_games(q.exercise_shixun_challenges.pluck(:challenge_id)) : nil) %>
<% user_answer = (q_type == 5 ? q.exercise_shixun_answers.where(user_id: @ex_user_user.id) : q.exercise_answers.where(user_id: @ex_user_user.id)) %>
<% this_ques_status = @ex_obj_array.detect{|f| f[:q_id] == q.id} %>
<% main_ques_status = @ex_sub_array.detect{|f| f[:q_id] == q.id} %>
@ -247,8 +248,8 @@
<th width="13%">得分/满分</th>
</thead>
<tbody>
<% if @games.size > 0 %>
<% @games.each_with_index do |game, index| %>
<% if games.present? %>
<% games&.each_with_index do |game, index| %>
<% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %>
<% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id: game_score&.first&.id,user_id: @ex_user_user.id) %>
<tr>
@ -286,7 +287,7 @@
<p class="text-gray mbt10">
<span class="fl font-bd">实训详情</span>
</p>
<% @games.each_with_index do |game, index| %>
<% games&.each_with_index do |game, index| %>
<div class="mbt10">
<p class="clearfix">
<span class="fl mt3"><span class="font-bd mr15">第<%= index+1 %>关</span><%= game.challenge.subject %></span>

Loading…
Cancel
Save