Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

issues25489
杨树明 5 years ago
commit 0775a63144

@ -1512,7 +1512,7 @@ class HomeworkCommonsController < ApplicationController
end_time = game.end_time
# 用户关卡的得分
all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f
final_score = @student_work.work_challenge_score game, all_score
final_score = @student_work.work_challenge_score game, all_score, challenge.id
# 抄袭用户
copy_user = User.find_by_id(game_codes[0].try(:target_user_id))
copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present?

@ -213,7 +213,7 @@ class MessagesController < ApplicationController
def notify_course_students message, course
course.students.includes(:user).each do |student|
UserMailer.course_message_email(student&.user&.mail, message.id).deliver_later if student&.user&.mail
UserMailer.course_message_email(student&.user&.mail, message.id).deliver_now if student&.user&.mail
end
end
end

@ -464,6 +464,7 @@ class StudentWorksController < ApplicationController
@shixun = @homework.shixuns.take
# 提示: 这里如果includes outputs表的话 sum(:evaluate_count)会出现错误
@games = @work.myshixun.games.joins(:challenge).reorder("challenges.position asc") if @work.myshixun
@challenges = @shixun.challenges if @shixun
@comment = @work.shixun_work_comments.find_by(challenge_id: 0)
# 用户最大评测次数
@ -517,6 +518,7 @@ class StudentWorksController < ApplicationController
@user = @work.user
@shixun = @homework.shixuns.take
@games = @work.myshixun.games.includes(:challenge, :game_codes, :outputs) if @work.myshixun
@challenges = @shixun.challenges if @shixun
# 用户最大评测次数
@user_evaluate_count = @games.pluck(:evaluate_count).sum if @games
@ -717,9 +719,10 @@ class StudentWorksController < ApplicationController
tip_exception("参数错误score和challenge_id不能为空")
end
challenge_setting = @homework.homework_challenge_settings.find_by(challenge_id: params[:challenge_id])
if challenge_setting
challenge = challenge_setting&.challenge
tip_exception("不能小于零") if params[:score].to_i < 0
tip_exception("不能大于关卡分值:#{challenge_setting.score}") if challenge_setting.score < params[:score].to_i
tip_exception("不能大于关卡分值:#{challenge_setting.score}") if challenge_setting && challenge_setting.score < params[:score].to_i
ActiveRecord::Base.transaction do
begin
@ -732,13 +735,20 @@ class StudentWorksController < ApplicationController
challenge_score = @work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score],
comment: comment)
challenge_score.create_tiding current_user.id
HomeworksService.new.update_myshixun_work_score @work, @work&.myshixun, @work&.myshixun&.games, @homework, @homework.homework_challenge_settings
if @work.work_status != 0 && @work.myshixun
HomeworksService.new.update_myshixun_work_score @work, @work.myshixun, @work.myshixun&.games, @homework, @homework.homework_challenge_settings
else
update_none_commit_work @work, @homework
end
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
tip_exception("调分失败")
raise ActiveRecord::Rollback
end
end
else
tip_exception("该关卡不记分")
end
end
@ -860,4 +870,20 @@ class StudentWorksController < ApplicationController
end
end
end
def update_none_commit_work work, homework
if work.work_status == 0
work.work_status = 1
work.commit_time = homework.end_time
work.update_time = Time.now
end
final_score = 0
homework.homework_challenge_settings.each do |cha_setting|
adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == cha_setting.challenge_id}.last
final_score += adjust_score.score if adjust_score.present?
end
work.final_score = final_score
work.work_score = final_score
work.save!
end
end

@ -1,5 +1,5 @@
class TrustieHacksController < ApplicationController
before_action :require_admin, :except => [:index]
before_action :require_admin, :except => [:index, :entry]
before_action :require_login, :except => [:index]
before_action :find_hackathon
before_action :find_hack, :except => [:create, :index, :edit_hackathon, :update_hackathon]
@ -15,7 +15,7 @@ class TrustieHacksController < ApplicationController
hacks = hacks.where("name like ?", "%#{search}%")
end
@hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count)
@hackathon_users_count = hacks.blank? ? 0 : hacks.sum(:hack_users_count)
@hacks_count = hacks.count
@hacks = hacks.page(page).per(limit)
@ -49,10 +49,10 @@ class TrustieHacksController < ApplicationController
# 报名入口
def entry
if @hack.hack_users.exists?(user_id: current_user)
if @hack.hack_users.exists?(user_id: current_user.id)
render_error('已经报名,请勿重复操作')
else
@hack.hack_users.create(user_id: current_user)
@hack.hack_users.create(user_id: current_user.id)
render_ok
end
end

@ -19,7 +19,7 @@ module StudentWorksHelper
# 作业的开启时间
def myshixun_open_time game
game.open_time ? (format_time game.open_time) : "--"
game&.open_time ? (format_time game.open_time) : "--"
end
# 作业完成时间
@ -29,7 +29,7 @@ module StudentWorksHelper
# 作业耗时
def time_consuming game
game.end_time.blank? ? "--" : (game_spend_time game.cost_time)
game&.end_time.blank? ? "--" : (game_spend_time game.cost_time)
end
# 用户个人实训总得分user_total_score

@ -196,12 +196,12 @@ class StudentWork < ApplicationRecord
student_works_scores.where.not(reviewer_role: 3, score: nil).exists?
end
def work_challenge_score game, score
def work_challenge_score game, score, challenge_id
game_score = 0
adjust_score = challenge_work_scores.where(challenge_id: game.challenge_id).last
adjust_score = challenge_work_scores.where(challenge_id: challenge_id).last
if adjust_score.present?
game_score = adjust_score.score
else
elsif game.present?
setting = homework_common.homework_group_setting game.user_id
if game.status == 2 && ((game.end_time && game.end_time < setting.end_time) || (homework_common.allow_late && game.end_time && game.end_time < homework_common.late_time))
answer_open_evaluation = homework_common.homework_detail_manual.answer_open_evaluation

@ -1,4 +1,5 @@
class TrustieHack < ApplicationRecord
validates_length_of :description, maximum: 500
has_many :hack_users, :dependent => :destroy
belongs_to :trustie_hackathon, counter_cache: true

@ -1,5 +1,5 @@
class TrustieHackathon < ApplicationRecord
validates_length_of :description, maximum: 500
has_many :trustie_hacks, :dependent => :destroy
end

@ -76,22 +76,23 @@
<th>调分</th>
</thead>
<tbody>
<% @games.each_with_index do |game, index| %>
<% challenge_score = @homework.challenge_score game.challenge_id %>
<% game_score = @work.work_challenge_score game, challenge_score %>
<% @challenges.each_with_index do |challenge, index| %>
<% challenge_score = @homework.challenge_score challenge.id %>
<% game = @games.select{|game| game.challenge_id == challenge.id}.first if @games %>
<% game_score = @work.work_challenge_score game, challenge_score, challenge.id %>
<tr>
<td><%= index + 1 %></td>
<td style="text-align: left;">
<span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span>
<% if ((Time.now > @homework.end_time) && game.end_time.blank?) || (game.end_time.present? && game.end_time > @homework.end_time) %>
<span class="task-hide edu-info-dark fl"><%= challenge.subject %></span>
<% if game && (((Time.now > @homework.end_time) && game.end_time.blank?) || (game.end_time.present? && game.end_time > @homework.end_time)) %>
<span class="delay ml10">延时</span>
<% end %>
</td>
<td><%= myshixun_open_time(game) %></td>
<td><%= game.evaluate_count %></td>
<td><%= finished_time game.end_time %></td>
<td><%= game ? game&.evaluate_count : 0 %></td>
<td><%= game ? finished_time(game.end_time) : "--" %></td>
<td><%= ApplicationController.helpers.time_consuming game %></td>
<td><%= game.final_score %> / <%= game.challenge.all_score %></td>
<td><%= game ? game.final_score : 0 %> / <%= challenge.all_score %></td>
<td><span class="color-orange"><%= game_score %></span> / <%= challenge_score %></td>
<td><%= game_score %></td>
</tr>

@ -7,40 +7,41 @@ if @shixun
json.shixun_name @shixun.name
# 总体评价
json.overall_appraisal @work.overall_appraisal
json.myself_experience @work.myshixun.try(:total_score)
json.myself_experience @work.myshixun.try(:total_score).to_i
json.total_experience @shixun.all_score
json.work_score number_with_precision @work.work_score, precision: 1
json.work_score number_with_precision @work.work_score.to_f.round(2), precision: 1
json.all_work_score number_with_precision 100, precision: 1
json.time_consuming @work.myshixun_consume
json.evaluate_count @user_evaluate_count.to_i
if @homework.work_efficiency
json.eff_score_full number_with_precision @homework.eff_score, precision: 1
json.eff_score number_with_precision @work.eff_score, precision: 1
json.eff_score number_with_precision @work.eff_score.to_f.round(2), precision: 1
json.challenge_score_full number_with_precision (100 - @homework.eff_score), precision: 1
json.challenge_score number_with_precision @work.final_score, precision: 1
json.challenge_score number_with_precision @work.final_score.to_f.round(2), precision: 1
end
# 阶段成绩
json.stage_list do
json.array! @games do |game|
json.name game.challenge.subject
json.is_delay student_work_is_delay?(@homework, game)
json.array! @challenges do |challenge|
json.name challenge.subject
game = @games.select{|game| game.challenge_id == challenge.id}.first if @games
json.is_delay game ? student_work_is_delay?(@homework, game) : false
json.open_time myshixun_open_time game
json.evaluate_count game.evaluate_count
json.finished_time finished_time game.end_time
json.evaluate_count game ? game&.evaluate_count : 0
json.finished_time game ? finished_time(game.end_time) : "--"
json.time_consuming time_consuming game
json.myself_experience game.final_score
json.experience game.challenge.all_score
json.complete_status game_status(game, @homework)
json.challenge_id game.challenge_id
challenge_score = @homework.challenge_score game.challenge_id
json.myself_experience game ? game&.final_score : 0
json.experience challenge.all_score
json.complete_status game ? game_status(game, @homework) : 0
json.challenge_id challenge.id
challenge_score = @homework.challenge_score challenge.id
json.game_score_full challenge_score
json.game_score @work.work_challenge_score game, challenge_score
challenge_comment = @work.shixun_work_comments.find_by(challenge_id: game.challenge_id)
json.game_score @work.work_challenge_score game, challenge_score, challenge.id
challenge_comment = @work.shixun_work_comments.find_by(challenge_id: challenge.id)
json.challenge_comment challenge_comment&.comment
json.challenge_comment_hidden @user_course_identity < Course::STUDENT ? challenge_comment&.hidden_comment : nil
json.comment_id challenge_comment&.id
json.view_answer game.answer_open != 0
json.view_answer game ? game.answer_open != 0 : 0
end
end
@ -52,7 +53,7 @@ if @shixun
json.username @user.real_name
json.student_id @user.student_id
json.image_url url_to_avatar(@user)
json.complete_count @work.myshixun&.passed_count
json.complete_count @work.myshixun&.passed_count.to_i
json.challenges_count @shixun.challenges_count
json.efficiency @homework.work_efficiency ? number_with_precision(@work.efficiency, precision: 2) : nil
json.max_efficiency @homework.work_efficiency ? number_with_precision(@homework.max_efficiency, precision: 2) : nil

@ -0,0 +1,6 @@
class ModifyDescriotionLimitForHacks < ActiveRecord::Migration[5.2]
def change
change_column :trustie_hackathons, :description, :text
change_column :trustie_hacks, :description, :text
end
end

@ -62,7 +62,7 @@ class PollDetailTabForthRules extends Component{
this.unitChoose(this.props.rules);
}
if(this.props.flagPageEdit != prevProps.flagPageEdit){
this.setState({flagPageEdit:this.props.flagPageEdit})
this.setState({flagPageEdit: this.props.flagPageEdit})
}
}
componentDidMount=()=>{
@ -359,7 +359,7 @@ class PollDetailTabForthRules extends Component{
{
rules && rules.length > 0 && rules.map((rule,r)=>{
const courseGroup = rule.course_search !="" ?
const courseGroup = rule.course_search != "" ?
course_group.filter( item => item.course_group_name.indexOf(rule.course_search) != -1)
:course_group
@ -462,7 +462,7 @@ class PollDetailTabForthRules extends Component{
format="YYYY-MM-DD HH:mm"
disabledTime={disabledDateTime}
disabledDate={disabledDate}
disabled={ rule.e_timeflag ===undefined?rule.publish_time===null?false:!flagPageEdit:rule.e_timeflag == true ? true : !flagPageEdit}
disabled={rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit}
style={{"height":"42px"}}
></DatePicker>
</span>

@ -26,6 +26,7 @@ import '../css/members.css';
import '../css/busyWork.css';
import '../poll/pollStyle.css';
import './Challenges.css';
import {getImageUrl} from 'educoder';
import TraineetraininginformationModal from "./TraineetraininginformationModal";
import DownloadMessageysl from '../../modals/DownloadMessageysl';
@ -952,9 +953,9 @@ class Listofworksstudentone extends Component {
key: 'classroom',
dataIndex: 'classroom',
align: 'center',
className: 'font-14',
className: 'font-14 maxnamewidth120',
render: (text, record) => (
<span>
<span className="maxnamewidth120">
{record.classroom === undefined ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
@ -963,7 +964,8 @@ class Listofworksstudentone extends Component {
textAlign: "center"
}}>--</span> : record.classroom === null ?
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> :
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>}
<a className="ysltable maxnamewidth120" title={record.classroom}
style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</a>}
</span>
)
},
@ -1218,7 +1220,7 @@ class Listofworksstudentone extends Component {
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a> :
<span>
<a style={{textAlign: "center"}} className="color-blue"
<a style={{textAlign: "center"}} className="color-blue maxnamewidth120"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a>
</span>
@ -1299,9 +1301,9 @@ class Listofworksstudentone extends Component {
key: 'classroom',
dataIndex: 'classroom',
align: 'center',
className: 'font-14',
className: 'font-14 maxnamewidth120',
render: (text, record) => (
<span>
<span className="maxnamewidth120">
{record.classroom === undefined ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
@ -1309,8 +1311,9 @@ class Listofworksstudentone extends Component {
color: '#07111B',
textAlign: "center"
}}>--</span> : record.classroom === null ?
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> :
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>}
<span className="ysltable " style={{color: '#07111B', textAlign: "center"}}>--</span> :
<a className="ysltable maxnamewidth120" title={record.classroom}
style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</a>}
</span>
)
},

@ -51,6 +51,14 @@
white-space:nowrap;
cursor: default;
}
.maxnamewidth120 {
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth200{
max-width: 200px;
overflow:hidden;

Loading…
Cancel
Save