From 1cdc0bdfd6ec480f9e0130c1eb8d9df347a79146 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 4 Jun 2019 09:49:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AD=97=E9=9D=A2=E6=9B=B4=E6=94=B9=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/colleges/statistics.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index 0a159d2a..98c5be73 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -19,7 +19,7 @@ <%= @courses_count %>
  • - 发布实训 + 共建实训 <%= @shixuns_count %>
  • @@ -32,7 +32,7 @@
  • 教师
  • 学生
  • 课堂
  • -
  • 实训
  • +
  • 共建实训
  • 实训报告
  • 学员实战时间
  • From 40afc495e753576051ba7d0fcf94ca8d882fb32d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Jun 2019 19:51:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=BF=81=E7=A7=BB27641=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=95=88=E7=8E=87=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190604115012_migrate_homework_eff_score.rb | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 db/migrate/20190604115012_migrate_homework_eff_score.rb diff --git a/db/migrate/20190604115012_migrate_homework_eff_score.rb b/db/migrate/20190604115012_migrate_homework_eff_score.rb new file mode 100644 index 00000000..22e05e65 --- /dev/null +++ b/db/migrate/20190604115012_migrate_homework_eff_score.rb @@ -0,0 +1,41 @@ +class MigrateHomeworkEffScore < ActiveRecord::Migration + def up + homework = HomeworkCommon.where(id: 27641).first + if homework.present? + max_efficiency = homework.max_efficiency + homework.student_works.where(compelete_status: 1).each do |work| + user_total_score = 0 + pass_consume_time = 0 + myshixun = work.myshixun + homework.homework_challenge_settings.each do |setting| + game = myshixun.games.where(:challenge_id => setting.challenge_id, :status => 2).first + unless game.nil? + pass_consume_time += (game.cost_time / 60.0).to_f + user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i + end + end + + efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0)) + work.update_column("efficiency", format("%.2f", efficiency)) + + if max_efficiency < work.efficiency + max_efficiency = work.efficiency + end + end + homework.update_column("max_efficiency", max_efficiency) + + homework.student_works.where("compelete_status != 0").each do |student_work| + eff_score = student_work.efficiency / homework.max_efficiency * homework.eff_score + student_work.eff_score = format("%.2f", eff_score) + unless student_work.ultimate_score + work_score = student_work.final_score.to_f + student_work.eff_score - student_work.late_penalty + student_work.work_score = format("%.2f", work_score < 0 ? 0 : work_score) + end + student_work.save + end + end + end + + def down + end +end From 487323a49ea9ef7171f35aaea0667b916571e31f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 5 Jun 2019 15:10:10 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=94=B9=E6=88=90=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BA=86=E7=9A=84=EF=BC=8C=E9=83=BD=E6=98=AF?= =?UTF-8?q?=E8=A6=81=E6=98=BE=E7=A4=BA=E7=9A=84=EF=BC=8C=E4=B8=8D=E7=AE=A1?= =?UTF-8?q?hidden=E7=9A=84=E5=80=BC=E6=98=AFtrue=E8=BF=98=E6=98=AFfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/comment/Comments.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 250cf16b..d1ac57d4 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -213,11 +213,12 @@ class Comments extends Component {
    - - { item.hidden && comment.admin === false && comment.manager === false + {/* 改成后端返回了的,都是要显示的,不管hidden的值是true还是false */} + {/* { item.hidden && comment.admin === false && comment.manager === false ?

    违规评论已被屏蔽!

    - :
    - } + : */} +
    + {/* } */}
    @@ -309,10 +310,12 @@ class Comments extends Component {
    - { item.hidden && item.admin === false && (item.manager === false || item.manager == undefined) + {/* 改成后端返回了的,都是要显示的,不管hidden的值是true还是false */} + {/* { item.hidden && item.admin === false && (item.manager === false || item.manager == undefined) ?

    违规评论已被屏蔽!

    - :
    - } + : */} +
    + {/* } */}
    From 7d34217b9e38218c017622b16d2584e7a983b98a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 5 Jun 2019 15:17:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=A6=82=E6=9E=9C=E9=80=89?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=98=AF=E8=80=81=E5=B8=88=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E7=BB=99=E9=9B=85=E8=8F=B2=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=91=E9=80=81=E4=B8=80=E6=9D=A1=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 9 ++++++++- lib/trustie/sms/sms.rb | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 60096a22..128475e6 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -456,7 +456,9 @@ class AccountController < ApplicationController @pref = @user.pref @se = @user.extensions - # 已授权的用户修改单位名称,需要重新授权 + old_identity = @se.identity + + # 已授权的用户修改单位名称,需要重新授权 if @se.school_id != params[:occupation].to_i && @user.certification == 1 @user.certification = 0 apply_user = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization") @@ -510,10 +512,15 @@ class AccountController < ApplicationController @se.technical_title = params[:pro_technical_title] if params[:pro_technical_title] @se.student_id = nil end + # @se.brief_introduction = params[:brief_introduction] if @user.save && @se.save + if old_identity.nil? && @se.identity == 0 + Trustie::Sms.send(mobile: '17680641960', send_type:'teacher_register', name: @user.login, user_name: "管理员") + end + reward_grade(@user, @user.id, 'Account', 500) if @user.certification != 1 diff --git a/lib/trustie/sms/sms.rb b/lib/trustie/sms/sms.rb index 2cab61fa..33584a0c 100644 --- a/lib/trustie/sms/sms.rb +++ b/lib/trustie/sms/sms.rb @@ -31,6 +31,8 @@ module Trustie params['text'] = "" if send_type.nil? params['text'] = "【Edu实训】" + code + "(手机验证码)。如非本人操作,请忽略。" + elsif send_type == "teacher_register" + params['text'] = "【Edu实训】亲爱的#{user_name},有新的老师#{name}注册啦,请尽快处理" elsif send_type == 'competition_start' params['text'] = "【Edu实训】亲爱的#{user_name},你参与的#{name}将于#{result}开始,请及时参赛" Rails.logger.info "#{params['text']}"