diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 4cf16409a..3fea82bff 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -516,15 +516,19 @@ class AccountController < ApplicationController end if @user.save && @se.save @user.update_attributes(:professional_certification => 0) - diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO') - diskfilePRO = diskfile2 + 'temp' - begin - FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO - ensure - File.delete(diskfilePRO) if File.exist?(diskfilePRO) - end - if File.exist?(diskfile2) + if @se.identity == 1 ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2) + else + diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO') + diskfilePRO = diskfile2 + 'temp' + begin + FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO + ensure + File.delete(diskfilePRO) if File.exist?(diskfilePRO) + end + if File.exist?(diskfile2) + ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2) + end end end redirect_to professional_certification_account_path diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index c3b206165..faa0ade1d 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -86,7 +86,7 @@ class GamesController < ApplicationController had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1)) @had_test_count = had_test.count @had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count - @had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count + #@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count @had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count @had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count @final_score = ((@game.answer_open? || @shixun.status <= 1) ? 0 : @game.final_score.to_i) @@ -271,7 +271,7 @@ class GamesController < ApplicationController had_test = Output.where(:game_id => @game.id, :query_index => (@game.query_index - 1)) @had_test_count = had_test.count @had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count - @had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count + #@had_passed_testsests_error_count = @had_test_count - @had_passed_testsests_error_count @had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count @had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count @final_score = ((@game.answer_open? || shixun.status <= 1) ? 0 : @game.final_score.to_i) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 236c695f1..cb9058dee 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -154,7 +154,7 @@ class MyController < ApplicationController if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil? @require_auth = true else - if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) < Time.now.to_i)) + if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) < Time.now.to_i)) @require_trail_auth = true end end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index d4dfe0981..5fa93690f 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -463,14 +463,20 @@ class ShixunsController < ApplicationController @shixun = Shixun.new(params[:shixun]) @shixun.user_id = User.current.id @shixun.language = params[:language] - @shixun.major_id = params[:major_id] + #@shixun.major_id = params[:major_id] @shixun.trainee = params[:trainee] @shixun.webssh = params[:webssh].to_i @shixun.identifier = identifier - if params[:course_id] - params[:course_id].each do |course_id| - @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) - end + # if params[:course_id] + # params[:course_id].each do |course_id| + # @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) + # end + # end + if CourseList.where(:name => params[:course_list].strip).count > 0 + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id) + else + course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0) + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id) end (params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false) ActiveRecord::Base.transaction do @@ -534,13 +540,20 @@ class ShixunsController < ApplicationController @shixun.language = params[:language] @shixun.trainee = params[:trainee] @shixun.webssh = params[:webssh].to_i - if params[:course_id] - @shixun.shixun_major_courses.destroy_all - params[:course_id].each do |course_id| - @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) - end + # if params[:course_id] + # @shixun.shixun_major_courses.destroy_all + # params[:course_id].each do |course_id| + # @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) + # end + # end + # @shixun.major_id = params[:major_id] + @shixun.shixun_major_courses.destroy_all + if CourseList.where(:name => params[:course_list].strip).count > 0 + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id) + else + course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0) + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id) end - @shixun.major_id = params[:major_id] params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0 ActiveRecord::Base.transaction do begin diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index b4ab956e3..1bd8599dc 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -99,32 +99,32 @@ module StudentWorkHelper project = cur_user_projects_for_homework homework if work.nil? && homework.end_time >= Time.now if homework.homework_type == 4 - link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true + link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true else - link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr' + link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8' end elsif work.nil? && homework.end_time < Time.now if homework.allow_late && homework.homework_detail_manual.comment_status < 6 if homework.homework_type == 4 - link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true + link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true else - link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr' + link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8' end end elsif work if homework.homework_type == 4 myshixun = Myshixun.find work.myshixun_id - link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10",:target => "_blank" if myshixun + link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10 mt8",:target => "_blank" if myshixun else work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 - link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品" + link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3 - link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束" + link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "匿评已结束" elsif homework.end_time >= Time.now && work.user_id == User.current.id - link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr' + link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr mr10 mt8' else - link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mt8 mr15', :title => "作业截止后不可修改作品" + link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "作业截止后不可修改作品" end end end diff --git a/app/views/account/_pro_certification_form.html.erb b/app/views/account/_pro_certification_form.html.erb index dac38879c..853b29803 100644 --- a/app/views/account/_pro_certification_form.html.erb +++ b/app/views/account/_pro_certification_form.html.erb @@ -35,14 +35,14 @@
- 请选择你的职业/职称 + 请选择你的职业/职称你的单位不在列表中?请点击申请添加
- 请从下拉列表中选择你的单位 + 请从下拉列表中选择你的单位