diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index e94cf8a21..b3ec6da63 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -62,6 +62,17 @@ module LoginHelper end def start_user_session(user) + # re_subdomain = "#{request.subdomain.split('.').first}_user_id" + # session[:"#{request.subdomain}_user_id"] = user.id + # Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + # Rails.logger.info("user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + # + # # if current_laboratory.main_site? + # # session[:user_id] = user.id + # # else + # # session[:"#{request.subdomain}_user_id"] = user.id + # # end + session[:user_id] = user.id session[:ctime] = Time.now.utc.to_i session[:atime] = Time.now.utc.to_i diff --git a/app/controllers/gits_controller.rb b/app/controllers/gits_controller.rb index c9659302e..850458e65 100644 --- a/app/controllers/gits_controller.rb +++ b/app/controllers/gits_controller.rb @@ -49,6 +49,12 @@ class GitsController < ApplicationController repo_name = username + "/" + shixunname uid_logger("git start: repo_name is #{repo_name}") shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first + if shixun.blank? + shixun_id = ShixunSecretRepository.where(repo_name: repo_name).pluck(:shixun_id).first + logger.info("####repo_name:#{repo_name}") + logger.info("####shixun_id:#{shixun_id}") + shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).find_by(id: shixun_id) + end uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}") uid_logger("git start auth: systemuser is #{system_user.try(:login)}") diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 56cda57d7..9602673e5 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -103,7 +103,7 @@ class HackUserLastestCodesController < ApplicationController if exec_mode == "submit" @hack.hack_sets.map{|set| {input: set.input, output: set.output, caseId: set.id}} else - {input: params[:input]} + [{input: params[:input]}] end testCases = Base64.urlsafe_encode64(test_sets.to_json) #codeFileContent = Base64.urlsafe_encode64(@my_hack.code) @@ -136,7 +136,9 @@ class HackUserLastestCodesController < ApplicationController if @my_hack.hack_user_debug.present? @my_hack.hack_user_debug.update_attributes!(debug_params) else - @my_hack.hack_user_debug.create!(debug_params) + debug = HackUserDebug.new(debug_params) + debug.hack_user_lastest_code_id = @my_hack.id + debug.save! end end diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 9fa8e26e3..915e58882 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -27,7 +27,7 @@ class HacksController < ApplicationController # 筛选过滤与排序 params_filter_or_order # 我解决的编程题数 - user_codes = HackUserLastestCode.mine(current_user).passed.joins(:hack) + user_codes = HackUserLastestCode.joins(:hack).mine_hack(current_user).passed @simple_count = user_codes.where(hacks: {difficult: 1}).count @medium_count = user_codes.where(hacks: {difficult: 2}).count @diff_count = user_codes.where(hacks: {difficult: 3}).count diff --git a/app/models/hack_user_lastest_code.rb b/app/models/hack_user_lastest_code.rb index 1d3e20f87..b4a707603 100644 --- a/app/models/hack_user_lastest_code.rb +++ b/app/models/hack_user_lastest_code.rb @@ -9,6 +9,7 @@ class HackUserLastestCode < ApplicationRecord has_many :hack_user_codes, dependent: :destroy has_one :hack_user_debug scope :mine, ->(author_id){ find_by(user_id: author_id) } + scope :mine_hack, ->(author_id){ where(user_id: author_id) } scope :passed, -> {where(status: 1)} end diff --git a/config/routes.rb b/config/routes.rb index abe31340d..81c419a7e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,7 +44,9 @@ Rails.application.routes.draw do get :start get :result end - resources :comments + resources :comments do + + end end resources :hack_user_lastest_codes, path: :myproblems, param: :identifier do diff --git a/db/migrate/20191120123353_add_code_forhack_user_debugs.rb b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb new file mode 100644 index 000000000..d3285f26b --- /dev/null +++ b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb @@ -0,0 +1,5 @@ +class AddCodeForhackUserDebugs < ActiveRecord::Migration[5.2] + def change + add_column :hack_user_debugs, :code, :text + end +end diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js index d5c8aa57f..5430b9e8c 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/ConclusionEvaluation.js @@ -58,7 +58,7 @@ class ConclusionEvaluation extends Component { - 分数:{record.eff_scores.eff_score}/总分:{record.eff_score_full} + 分数:{record.eff_scores.eff_score}/总分:{record.eff_scores.eff_score_full} }> {record.eff_scores.eff_score}/{record.eff_scores.eff_score_full} diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 6971cf36c..68e37deb6 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -149,9 +149,9 @@ class ShixunsHome extends Component {