dev_trainings
daiao 6 years ago
commit 09eed36ec6

@ -456,6 +456,8 @@ 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
@ -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

@ -19,7 +19,7 @@
<span><%= @courses_count %></span>
</li>
<li>
<span>发布实训</span>
<span>共建实训</span>
<span><%= @shixuns_count %></span>
</li>
</ul>
@ -32,7 +32,7 @@
<li>教师</li>
<li>学生</li>
<li>课堂</li>
<li>实训</li>
<li>共建实训</li>
<li>实训报告</li>
<li>学员实战时间</li>
<!-- <li>云主机</li>-->

@ -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

@ -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']}"

@ -213,11 +213,12 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}>
{ item.hidden && comment.admin === false && comment.manager === false
{/* 改成后端返回了的都是要显示的不管hidden的值是true还是false */}
{/* { item.hidden && comment.admin === false && comment.manager === false
? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div dangerouslySetInnerHTML={{__html: _content}}></div>
}
: */}
<div dangerouslySetInnerHTML={{__html: _content}}></div>
{/* } */}
<div className="cl"></div>
</div>
@ -309,10 +310,12 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}>
{ 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)
? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div dangerouslySetInnerHTML={{__html: _content}}></div>
}
: */}
<div dangerouslySetInnerHTML={{__html: _content}}></div>
{/* } */}
<div className="cl"></div>
</div>
</div>

Loading…
Cancel
Save