From 4075bfc269eeb2b501adb09eaa8fa03e95e42748 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:16:28 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E5=85=A5=E5=8F=A3=E4=B8=8E=E7=8A=B6=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/polls_helper.rb | 2 +- app/models/poll.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 866d28254..7ae4470e2 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -77,7 +77,7 @@ module PollsHelper ex_pb_time = poll.get_poll_times(user.id,false) poll_publish_time = ex_pb_time[:publish_time] poll_end_time = ex_pb_time[:end_time] - current_status = poll.check_user_votes_status(user) + current_status = poll.check_user_votes_status(user, poll_status) lock_icon = 0 #不显示锁图标 else poll_users_list = poll.get_poll_exercise_users diff --git a/app/models/poll.rb b/app/models/poll.rb index 9cb860f61..f3a16198c 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -146,12 +146,15 @@ class Poll < ApplicationRecord end #判断当前用户的答题状态 - def check_user_votes_status(user) + def check_user_votes_status(user, poll_status) poll_answer_user = poll_users.where(user_id: user.id).select(:start_at,:end_at,:commit_status) user_status = 2 if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 user_status = poll_answer_user.first.commit_status end + if poll_status > 2 + user_status = user_status == 1 ? 1 : 4 + end user_status end From 5eeef267e56666f7d08fd80f401bff944bc783b6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:19:33 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/polls_controller.rb | 4 ++-- app/models/poll.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 5a3fda7a4..068a0dafd 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -198,14 +198,14 @@ class PollsController < ApplicationController def common_header ActiveRecord::Base.transaction do begin + @poll_status = @poll.get_poll_status(current_user) if @user_course_identity > Course::ASSISTANT_PROFESSOR @is_teacher_or = 0 - @user_poll_answer = @poll.check_user_votes_status(current_user) + @user_poll_answer = @poll.check_user_votes_status(current_user, @poll_status) else @is_teacher_or = 1 @user_poll_answer = 3 #教师页面 end - @poll_status = @poll.get_poll_status(current_user) poll_id_array = [@poll.id] @poll_publish_count = get_user_permission_course(poll_id_array,2).count #是否存在已发布的 @poll_unpublish_count = get_user_permission_course(poll_id_array,1).count #是否存在未发布的 diff --git a/app/models/poll.rb b/app/models/poll.rb index f3a16198c..626f55dcb 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -152,7 +152,14 @@ class Poll < ApplicationRecord if poll_answer_user.exists? && (poll_answer_user.first&.start_at.present? || poll_answer_user.first&.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 user_status = poll_answer_user.first.commit_status end + # 问卷已截止时学生的答题状态需要考虑问卷的状态 if poll_status > 2 + # 问卷如果还是继续答题状态则自动提交 + if user_status = 0 + poll_end_time = get_poll_times(user.id,false) + poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) + user_status = 1 + end user_status = user_status == 1 ? 1 : 4 end user_status From c88a998992ebf8a70e6ffefb0c3be912ca6919f7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:29:48 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index 626f55dcb..8eb8e6cf9 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -155,7 +155,7 @@ class Poll < ApplicationRecord # 问卷已截止时学生的答题状态需要考虑问卷的状态 if poll_status > 2 # 问卷如果还是继续答题状态则自动提交 - if user_status = 0 + if user_status == 0 poll_end_time = get_poll_times(user.id,false) poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) user_status = 1 From 34fed0365560f1cc3b5164d2dd4a00c049b81d83 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 25 Nov 2019 18:31:21 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index 8eb8e6cf9..ea6656ca2 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -156,7 +156,7 @@ class Poll < ApplicationRecord if poll_status > 2 # 问卷如果还是继续答题状态则自动提交 if user_status == 0 - poll_end_time = get_poll_times(user.id,false) + poll_end_time = get_poll_times(user.id,false)[:end_time] poll_answer_user.first.update_attributes!(:commit_status => 1, :end_at => poll_end_time) user_status = 1 end From ab5d36325705478dcc05f87095b31e658e13d4c1 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 18:52:36 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=B9=8B=E9=97=B4=E5=9F=9F=E5=90=8D=E5=88=87=E6=8D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 2 +- app/controllers/application_controller.rb | 14 ++++++++------ app/controllers/concerns/login_helper.rb | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 28a1b5b6e..3ad85d507 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -94,7 +94,7 @@ class AccountsController < ApplicationController successful_authentication(@user) login_control.clear # 重置每日密码错误次数 - session[:user_id] = @user.id + # session[:user_id] = @user.id end # 忘记密码 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c6aca5ae5..4c61fb1df 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -299,9 +299,11 @@ class ApplicationController < ActionController::Base # and starts a session if needed def find_current_user uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") - if session[:user_id] + uid_logger("0000000000000user setup start: session[:user_id] is #{session[:"#{default_yun_session}"]}") + current_domain_session = session[:"#{default_yun_session}"] + if current_domain_session # existing session - (User.active.find(session[:user_id]) rescue nil) + (User.active.find(current_domain_session) rescue nil) elsif autologin_user = try_to_autologin autologin_user elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth? @@ -313,10 +315,10 @@ class ApplicationController < ActionController::Base def try_to_autologin if cookies[autologin_cookie_name] # auto-login feature starts a new session - user = User.try_to_autologin(cookies[autologin_cookie_name]) - if user - start_user_session(user) - end + user = nil + Rails.logger.info("111111111111111111#{default_yun_session}, session is #{session[:"#{default_yun_session}"]} ") + user = User.try_to_autologin(cookies[autologin_cookie_name]) if session[:"#{default_yun_session}"] + start_user_session(user) if user user end end diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index 8497799e3..605d0faf4 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -73,8 +73,8 @@ module LoginHelper # # session[:"#{request.subdomain}_user_id"] = user.id # # end - session[:user_id] = user.id - # session[:"#{default_yun_session}"] = user.id + # session[:user_id] = user.id + session[:"#{default_yun_session}"] = user.id session[:ctime] = Time.now.utc.to_i session[:atime] = Time.now.utc.to_i end From ffc4e52114bf8da5754c40fbaa0c13c619521db2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 19:15:27 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixun_feedback_messages_controller.rb | 6 +++++ app/views/admins/shared/_sidebar.html.erb | 6 +++++ .../shixun_feedback_messages/index.html.erb | 14 +++++++++++ .../shared/_list.html.erb | 24 +++++++++++++++++++ app/views/hacks/edit.json.jbuilder | 2 +- config/routes.rb | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 app/controllers/admins/shixun_feedback_messages_controller.rb create mode 100644 app/views/admins/shixun_feedback_messages/index.html.erb create mode 100644 app/views/admins/shixun_feedback_messages/shared/_list.html.erb diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb new file mode 100644 index 000000000..c7e6a9586 --- /dev/null +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -0,0 +1,6 @@ +class Admins::ShixunFeedbackMessagesController < Admins::BaseController + + def index + + end +end \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index f78b52ac7..7b1f5db7a 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -65,6 +65,12 @@ <% end %> +
  • + <%= sidebar_item_group('#comments-submenu', '消息', icon: 'comments') do %> +
  • <%= sidebar_item(admins_shixun_feedback_messages_path, '实训反馈', icon: 'comment', controller: 'admins-shixun_feedback_messages') %>
  • + <% end %> + +
  • <%= sidebar_item_group('#major-identification-submenu', '工程认证', icon: 'anchor') do %>
  • <%= sidebar_item(admins_major_informations_path, '本科专业目录', icon: 'outdent', controller: 'admins-major_informations') %>
  • diff --git a/app/views/admins/shixun_feedback_messages/index.html.erb b/app/views/admins/shixun_feedback_messages/index.html.erb new file mode 100644 index 000000000..02e696cd3 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/index.html.erb @@ -0,0 +1,14 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('实训反馈', admins_shixun_feedback_messages_path) %> +<% end %> + +
    + <%= form_tag(admins_shixun_feedback_messages_path, method: :get, class: 'form-inline search-form', remote: true) do %> + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-md-4 ml-3', placeholder: '输入实训名称关键字进行搜索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> + <% end %> +
    + +
    + <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {}) %> +
    \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb new file mode 100644 index 000000000..65b9e0035 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + <% if true %> + + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
    ID标识实训名称实训老师完成经验值学员姓名学员单位11
    + +<%#= render partial: 'admins/shared/paginate', locals: { objects: myshixuns } %> \ No newline at end of file diff --git a/app/views/hacks/edit.json.jbuilder b/app/views/hacks/edit.json.jbuilder index 95124666f..efbf424b6 100644 --- a/app/views/hacks/edit.json.jbuilder +++ b/app/views/hacks/edit.json.jbuilder @@ -1,5 +1,5 @@ # 编程内容 -json.(@hack, :name, :description, :language, :code) +json.(@hack, :name, :description, :language, :difficult, :category, :time_limit) # 代码 json.language @hack.language diff --git a/config/routes.rb b/config/routes.rb index 86bac4533..0f31c6d48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1039,6 +1039,7 @@ Rails.application.routes.draw do end resources :shixuns, only: [:index,:destroy] resources :shixun_settings, only: [:index,:update] + resources :shixun_feedback_messages, only: [:index] resources :department_applies,only: [:index,:destroy] do collection do post :merge From 35139cb15c364bcddbf70400cbca89003a2d8da0 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 19:27:50 +0800 Subject: [PATCH 07/17] =?UTF-8?q?session=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 5 +++-- app/controllers/concerns/login_helper.rb | 2 +- app/controllers/oauth/base_controller.rb | 3 ++- app/controllers/weapps/registers_controller.rb | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 3ad85d507..3a7096b2a 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -60,7 +60,8 @@ class AccountsController < ApplicationController ua = UserAgent.find_by_ip(ip) ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua successful_authentication(@user) - session[:user_id] = @user.id + # session[:user_id] = @user.id + session[:"#{default_yun_session}"] = @user.id normal_status("注册成功") end rescue Exception => e @@ -158,7 +159,7 @@ class AccountsController < ApplicationController def logout UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip) - session[:user_id] = nil + session[:"#{default_yun_session}"] = nil logout_user render :json => {status: 1, message: "退出成功!"} end diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index 605d0faf4..cf0c8e1e3 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -47,7 +47,7 @@ module LoginHelper User.current.delete_session_token(session[:tk]) self.logged_user = nil end - session[:user_id] = nil + session[:"#{default_yun_session}"] = nil end # Sets the logged in user diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index e4068fbda..327f21845 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -12,7 +12,8 @@ class Oauth::BaseController < ActionController::Base private def session_user_id - session[:user_id] + # session[:user_id] + session[:"#{default_yun_session}"] end def current_user diff --git a/app/controllers/weapps/registers_controller.rb b/app/controllers/weapps/registers_controller.rb index 0cbab7fd4..fde0f0583 100644 --- a/app/controllers/weapps/registers_controller.rb +++ b/app/controllers/weapps/registers_controller.rb @@ -48,7 +48,8 @@ class Weapps::RegistersController < Weapps::BaseController ) end successful_authentication(@user) - session[:user_id] = @user.id + # session[:user_id] = @user.id + session[:"#{default_yun_session}"] = @user.id render_ok end From 2d7096a9d2516823d9f2e837e4e5fe3dc092dbef Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:11:35 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E4=B8=8D=E5=88=87=E6=8D=A2=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/laboratory_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index 37a3675f0..8302e4c6a 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -26,6 +26,6 @@ module LaboratoryHelper end def default_yun_session - @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + @_default_yun_session = "#{current_laboratory.split('.').first}_user_id" end end \ No newline at end of file From 17887cbd780d637d95741bb4f05bf4e6a9ca04ef Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:20:46 +0800 Subject: [PATCH 09/17] .. --- app/controllers/concerns/laboratory_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index 37a3675f0..8302e4c6a 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -26,6 +26,6 @@ module LaboratoryHelper end def default_yun_session - @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + @_default_yun_session = "#{current_laboratory.split('.').first}_user_id" end end \ No newline at end of file From c8fc047fd2290ff3953a7c86c1f2ab716596af6b Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:24:15 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E5=AD=90=E5=9F=9F=E5=90=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/laboratory_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index 8302e4c6a..314d921f2 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -26,6 +26,6 @@ module LaboratoryHelper end def default_yun_session - @_default_yun_session = "#{current_laboratory.split('.').first}_user_id" + @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" end end \ No newline at end of file From b4d68dfe7fe2227b15bc269659d09185d8f07834 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:28:13 +0800 Subject: [PATCH 11/17] test --- app/controllers/concerns/login_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index cf0c8e1e3..d4498ed7d 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -75,7 +75,7 @@ module LoginHelper # session[:user_id] = user.id session[:"#{default_yun_session}"] = user.id - session[:ctime] = Time.now.utc.to_i - session[:atime] = Time.now.utc.to_i + # session[:ctime] = Time.now.utc.to_i + # session[:atime] = Time.now.utc.to_i end end \ No newline at end of file From d1840a039cc42ff338e6051426845b85de70d147 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:30:05 +0800 Subject: [PATCH 12/17] test --- app/controllers/concerns/login_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index d4498ed7d..cf0c8e1e3 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -75,7 +75,7 @@ module LoginHelper # session[:user_id] = user.id session[:"#{default_yun_session}"] = user.id - # session[:ctime] = Time.now.utc.to_i - # session[:atime] = Time.now.utc.to_i + session[:ctime] = Time.now.utc.to_i + session[:atime] = Time.now.utc.to_i end end \ No newline at end of file From 5745ff8c28a2bf46ae4ece12669665cdb241696c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 25 Nov 2019 20:36:38 +0800 Subject: [PATCH 13/17] 1 --- .../shixun_feedback_messages_controller.rb | 4 ++- .../hack_user_lastest_codes_controller.rb | 2 +- .../shixun_feedback_messages/index.html.erb | 4 +-- .../shixun_feedback_messages/index.js.erb | 1 + .../shared/_list.html.erb | 28 +++++++++++-------- .../result.json.jbuilder | 13 ++++++--- app/views/hacks/edit.json.jbuilder | 2 +- 7 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 app/views/admins/shixun_feedback_messages/index.js.erb diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb index c7e6a9586..27c3f4225 100644 --- a/app/controllers/admins/shixun_feedback_messages_controller.rb +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -1,6 +1,8 @@ class Admins::ShixunFeedbackMessagesController < Admins::BaseController def index - + default_sort('created_at', 'desc') + @params_page = params[:page] || 1 + @discusses = paginate Discuss.where(:dis_type => 'Shixun').preload(:user) end end \ No newline at end of file diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index a4b41a162..2d749ce75 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -35,7 +35,7 @@ class HackUserLastestCodesController < ApplicationController # 提交结果显示 def result if @my_hack.submit_status == 1 - render json: {status:0, message: "正在评测中"} + render json: {status: 1, message: "正在评测中"} else @mode = params[:mode] @result = diff --git a/app/views/admins/shixun_feedback_messages/index.html.erb b/app/views/admins/shixun_feedback_messages/index.html.erb index 02e696cd3..730729646 100644 --- a/app/views/admins/shixun_feedback_messages/index.html.erb +++ b/app/views/admins/shixun_feedback_messages/index.html.erb @@ -9,6 +9,6 @@ <% end %> -
    - <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {}) %> +
    + <%= render(partial: 'admins/shixun_feedback_messages/shared/list', locals: {discusses: @discusses}) %>
    \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/index.js.erb b/app/views/admins/shixun_feedback_messages/index.js.erb new file mode 100644 index 000000000..38c393589 --- /dev/null +++ b/app/views/admins/shixun_feedback_messages/index.js.erb @@ -0,0 +1 @@ +$(".shixun_feedback_messages-list-container").html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {shixun_settings:@discusses} %>") \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 65b9e0035..370ac9df2 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -1,24 +1,28 @@ - - - - - - - - - + + + + + - <% if true %> - + <% if discusses.present? %> + <% discusses.each_with_index do |discuss, index| %> + + + + + + + + <% end %> <% else %> <%= render 'admins/shared/no_data_for_table' %> <% end %>
    ID标识实训名称实训老师完成经验值学员姓名学员单位11序号实训名称评论内容评论者评论时间
    <%= (@params_page.to_i - 1) * 20 + index + 1 %><%= discuss.dis.name %><%= content_safe discuss.content %><%= discuss.user.show_real_name %><%= format_time discuss.created_at %>
    -<%#= render partial: 'admins/shared/paginate', locals: { objects: myshixuns } %> \ No newline at end of file +<%= render partial: 'admins/shared/paginate', locals: { objects: discusses } %> \ No newline at end of file diff --git a/app/views/hack_user_lastest_codes/result.json.jbuilder b/app/views/hack_user_lastest_codes/result.json.jbuilder index 31164d4f7..2561d4ecd 100644 --- a/app/views/hack_user_lastest_codes/result.json.jbuilder +++ b/app/views/hack_user_lastest_codes/result.json.jbuilder @@ -1,7 +1,12 @@ -json.(@result, :id, :status, :error_line, :error_msg, - :input, :output, :execute_time, :execute_memory) +json.status 0 +json.message "评测成功" +json.data do + json.(@result, :id, :status, :error_line, :error_msg, + :input, :output, :execute_time, :execute_memory) # 提交模式多了一个预计输出 -if @mode == "submit" - json.expected_output @result.expected_output + if @mode == "submit" + json.expected_output @result.expected_output + end end + diff --git a/app/views/hacks/edit.json.jbuilder b/app/views/hacks/edit.json.jbuilder index efbf424b6..24d51385b 100644 --- a/app/views/hacks/edit.json.jbuilder +++ b/app/views/hacks/edit.json.jbuilder @@ -1,5 +1,5 @@ # 编程内容 -json.(@hack, :name, :description, :language, :difficult, :category, :time_limit) +json.(@hack, :name, :description, :language, :difficult, :category, :time_limit, :open_or_not) # 代码 json.language @hack.language From 2e95d0c6f77ff45f011a365c8046910996b3318c Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:38:17 +0800 Subject: [PATCH 14/17] .. --- app/controllers/concerns/laboratory_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index 314d921f2..ba5271623 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -26,6 +26,7 @@ module LaboratoryHelper end def default_yun_session - @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" - end + @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + # @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" + ensd end \ No newline at end of file From 783af746765f4a80cd5ad4584f62f959189dd41c Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 25 Nov 2019 20:38:50 +0800 Subject: [PATCH 15/17] .. --- app/controllers/concerns/laboratory_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index ba5271623..ecb478388 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -28,5 +28,5 @@ module LaboratoryHelper def default_yun_session @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" # @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" - ensd + end end \ No newline at end of file From f5816b227e72d0accde7c94b3368dc10378e08fc Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 09:10:40 +0800 Subject: [PATCH 16/17] fixbug --- app/views/admins/shixun_feedback_messages/shared/_list.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 370ac9df2..7737d1a47 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -13,6 +13,7 @@ <% discusses.each_with_index do |discuss, index| %> <%= (@params_page.to_i - 1) * 20 + index + 1 %> + <%# identifier = Game.find_by(challenge_id: discuss.challenge_id) %> <%= discuss.dis.name %> <%= content_safe discuss.content %> <%= discuss.user.show_real_name %> From 98d1b97a85018244f7bed7663390fee547a0a904 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Nov 2019 10:22:08 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=AE=9E=E8=AE=AD=E5=8F=8D=E9=A6=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/shixun_feedback_messages_controller.rb | 8 +++++++- app/views/admins/shixun_feedback_messages/index.js.erb | 3 ++- .../admins/shixun_feedback_messages/shared/_list.html.erb | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb index 27c3f4225..31fcc468c 100644 --- a/app/controllers/admins/shixun_feedback_messages_controller.rb +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -3,6 +3,12 @@ class Admins::ShixunFeedbackMessagesController < Admins::BaseController def index default_sort('created_at', 'desc') @params_page = params[:page] || 1 - @discusses = paginate Discuss.where(:dis_type => 'Shixun').preload(:user) + if params[:keyword] + discusses = Discuss.find_by_sql("select * from discusses join shixuns on discusses.dis_id = shixuns.id where discusses.dis_type='Shixun' AND + shixuns.name like '%#{params[:keyword]}%'") + else + discusses = Discuss.where(:dis_type => 'Shixun').includes(:user, :dis) + end + @discusses = paginate discusses end end \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/index.js.erb b/app/views/admins/shixun_feedback_messages/index.js.erb index 38c393589..6eab9be54 100644 --- a/app/views/admins/shixun_feedback_messages/index.js.erb +++ b/app/views/admins/shixun_feedback_messages/index.js.erb @@ -1 +1,2 @@ -$(".shixun_feedback_messages-list-container").html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {shixun_settings:@discusses} %>") \ No newline at end of file +$(".shixun_feedback_messages-list-container") + .html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {discusses: @discusses} %>") \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 7737d1a47..af81f9e58 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -13,8 +13,8 @@ <% discusses.each_with_index do |discuss, index| %> <%= (@params_page.to_i - 1) * 20 + index + 1 %> - <%# identifier = Game.find_by(challenge_id: discuss.challenge_id) %> - <%= discuss.dis.name %> + <% identifier = Game.find_by(challenge_id: discuss.challenge_id, user_id: discuss.user_id)&.identifier %> + <%= link_to discuss.dis.name, "/tasks/#{identifier}", target: '_blank'%> <%= content_safe discuss.content %> <%= discuss.user.show_real_name %> <%= format_time discuss.created_at %>