重置功能

dev_cs
cxt 5 years ago
parent 9279722fc4
commit d2fcd7208a

@ -247,7 +247,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
User.current = User.find 1
User.current = User.find 8686
end

@ -25,7 +25,8 @@ class MyshixunsController < ApplicationController
begin
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
StudentWork.where(:myshixun_id => @myshixun.id).update_all(myshixun_id: 0, work_status: 0, work_score: nil,
final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0)
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")

@ -240,6 +240,6 @@ module HomeworkCommonsHelper
def student_redo_work work, homework
publish_time = homework.homework_group_setting(work.user_id)&.publish_time
work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0
work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0 ? true : false
end
end

@ -31,7 +31,7 @@ elsif @user_course_identity == Course::STUDENT
json.left_time left_time @homework, @current_user.id
if @homework.homework_type == "practice"
json.(@work, :id, :work_status, :update_time, :ultimate_score, :myshixun_id)
json.(@work, :id, :work_status, :update_time, :ultimate_score)
json.calculation_time @work.calculation_time
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_spend_time)
@ -40,7 +40,8 @@ elsif @user_course_identity == Course::STUDENT
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
json.redo_work @homework.end_or_late ? false : student_redo_work(@work, @homework)
json.redo_work (@homework.end_or_late ? false : student_redo_work(@work, @homework))
json.myshixun_identifier @work.myshixun&.identifier
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)

Loading…
Cancel
Save