Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_cs
杨树林 5 years ago
commit 6bcc39b763

@ -458,7 +458,7 @@ class StudentWorksController < ApplicationController
@shixun = @homework.shixuns.take @shixun = @homework.shixuns.take
# 提示: 这里如果includes outputs表的话 sum(:evaluate_count)会出现错误 # 提示: 这里如果includes outputs表的话 sum(:evaluate_count)会出现错误
@games = @work.myshixun.games.joins(:challenge).reorder("challenges.position asc") if @work.myshixun @games = @work.myshixun.games.joins(:challenge).reorder("challenges.position asc") if @work.myshixun
@comment = @work.student_works_scores.shixun_comment.first @comment = @work.shixun_work_comments.find_by(challenge_id: 0)
# 用户最大评测次数 # 用户最大评测次数
if @games if @games
@ -474,20 +474,30 @@ class StudentWorksController < ApplicationController
# 实训作品的评阅 # 实训作品的评阅
def shixun_work_comment def shixun_work_comment
tip_exception("评阅不能为空") if params[:comment].blank? tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank?
tip_exception("缺少is_hidden参数") if params[:is_hidden].blank? || ![1, 0].include?(params[:is_hidden]) ActiveRecord::Base.transaction do
comment = @work.student_works_scores.shixun_comment.first || StudentWorksScore.new(student_work_id: @work.id, user_id: current_user.id) challenge = @homework.shixuns.first&.challenges.find_by(id: params[:challenge_id]) unless params[:challenge_id].blank?
if challenge.present?
comment = @work.shixun_work_comments.find_by(challenge_id: challenge.id) ||
ShixunWorkComment.new(student_work_id: @work.id, user_id: current_user.id, challenge_id: challenge.id)
else
comment = @work.shixun_work_comments.find_by(challenge_id: 0) ||
ShixunWorkComment.new(student_work_id: @work.id, user_id: current_user.id, challenge_id: 0)
end
comment.comment = params[:comment] comment.comment = params[:comment]
comment.is_hidden = params[:is_hidden] comment.hidden_comment = params[:hidden_comment]
comment.save! comment.save!
normal_status("评阅成功") normal_status("评阅成功")
end end
end
# 删除实训作品评阅 # 删除实训作品评阅
def destroy_work_comment def destroy_work_comment
@work.student_works_scores.shixun_comment.first.destroy! if @work.student_works_scores.shixun_comment.first.present? ActiveRecord::Base.transaction do
@work.shixun_work_comments.find_by!(id: params[:comment_id]).destroy_all
normal_status("删除成功") normal_status("删除成功")
end end
end
def export_shixun_work_report def export_shixun_work_report
@user = @work.user @user = @work.user

@ -0,0 +1,5 @@
class ShixunWorkComment < ApplicationRecord
belongs_to :student_work
belongs_to :user
belongs_to :challenge, optional: true
end

@ -7,6 +7,7 @@ class StudentWork < ApplicationRecord
belongs_to :myshixun, optional: true belongs_to :myshixun, optional: true
has_many :student_works_evaluation_distributions, dependent: :destroy has_many :student_works_evaluation_distributions, dependent: :destroy
has_many :student_works_scores, dependent: :destroy has_many :student_works_scores, dependent: :destroy
has_many :shixun_work_comments, dependent: :destroy
belongs_to :project, optional: true belongs_to :project, optional: true
# attachtype: 1正常提交的附件 7补交的附件 # attachtype: 1正常提交的附件 7补交的附件

@ -36,6 +36,9 @@ if @shixun
challenge_score = @homework.challenge_score game.challenge_id challenge_score = @homework.challenge_score game.challenge_id
json.game_score_full challenge_score json.game_score_full challenge_score
json.game_score @work.work_challenge_score game, 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.challenge_comment challenge_comment&.comment
json.challenge_comment_hidden challenge_comment&.hidden_comment
end end
end end
@ -54,8 +57,8 @@ if @shixun
json.passed_time @work.myshixun&.passed_time json.passed_time @work.myshixun&.passed_time
# 评阅信息 # 评阅信息
json.work_comment @user_course_identity < Course::STUDENT || !@comment&.is_hidden ? @comment&.comment : nil json.work_comment @comment&.comment
json.work_comment_hidden @comment&.is_hidden json.work_comment_hidden @user_course_identity < Course::STUDENT ? @comment&.hidden_comment : nil
# 图形统计 # 图形统计
# 1 效率 # 1 效率

@ -0,0 +1,13 @@
class CreateShixunWorkComments < ActiveRecord::Migration[5.2]
def change
create_table :shixun_work_comments do |t|
t.references :student_work, index: true, type: :integer
t.references :challenge, index: true, type: :integer, default: 0
t.references :user, index: true, type: :integer
t.text :comment
t.text :hidden_comment
t.timestamps
end
end
end

@ -0,0 +1,13 @@
class MigrateShixunWorkComment < ActiveRecord::Migration[5.2]
def change
StudentWorksScore.where(is_ultimate: 0, score: nil).where("created_at > '2019-09-04 00:00:00'").each do |work_score|
if work_score.student_work && work_score.student_work.homework_common&.shixuns
if work_score.is_hidden
ShixunWorkComment.create!(student_work_id: work_score.student_work_id, user_id: work_score.user_id, hidden_comment: work_score.comment)
else
ShixunWorkComment.create!(student_work_id: work_score.student_work_id, user_id: work_score.user_id, comment: work_score.comment)
end
end
end
end
end

@ -91,7 +91,7 @@ class AppraiseModal extends Component{
padding: 0px 15px 15px 15px; padding: 0px 15px 15px 15px;
} }
.font{ .font{
width: 48px;
height: 16px; height: 16px;
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
@ -111,15 +111,21 @@ class AppraiseModal extends Component{
</style> </style>
<div className="clearfix"> <div className="clearfix">
<p className={"font mt10 mb10"}> <p className={"font mt10 mb10"}>
权限 可见:(学生可查看老师的评阅内容
</p> </p>
<Radio.Group onChange={this.onChanges} value={this.state.valuetype}> {/*<Radio.Group onChange={this.onChanges} value={this.state.valuetype}>*/}
<Radio value={0} style={radioStyle} className={"newfont"}>可见 (学生查看老师的评阅内容</Radio> {/*<Radio value={0} style={radioStyle} className={"newfont"}>可见 (学生查看老师的评阅内容)</Radio>*/}
<Radio value={1} style={radioStyle} className={"newfont"}>不可见 (仅对课堂老师可见</Radio> {/*<Radio value={1} style={radioStyle} className={"newfont"}>不可见 (仅对课堂老师可见)</Radio>*/}
</Radio.Group> {/*</Radio.Group>*/}
<WordNumberTextarea
placeholder={"请填写评阅内容"}
onInput={(e)=>this.settextarea(e)}
value={textareaval}
maxlength={500}
/>
<p className={"font mt10 mb20"}> <p className={"font mt10 mb20"}>
内容 不可见:(仅对课堂老师可见
</p> </p>
<WordNumberTextarea <WordNumberTextarea
placeholder={"请填写评阅内容"} placeholder={"请填写评阅内容"}

@ -157,9 +157,44 @@ class Ecerciseallbackagain extends Component{
console.log() console.log()
return( return(
<div> <div>
<style>
{
`
@media (max-width: 2000px) {
.newupload_select_box{
height: 265px !important;
}
}
@media (max-width: 1350px) {
.HomeworkModal{
top:10px !important;
}
.newupload_select_box{
height: 220px !important;
}
}
@media (max-width: 1250px) {
.HomeworkModal{
top:0px !important;
}
.newupload_select_box{
height: 150px !important;
}
}
.eerxisbox:hover {
background: #e4eaf6;
}
.upload_select_box li:hover {
background:transparent;
}
`
}
</style>
<Modal <Modal
className={"HomeworkModal"} className={"HomeworkModal"}
style={{ top: 20 }}
title={this.props.modalname} title={this.props.modalname}
visible={this.props.visible} visible={this.props.visible}
closable={false} closable={false}
@ -175,6 +210,7 @@ class Ecerciseallbackagain extends Component{
} }
.fontlefts{text-align: left;} .fontlefts{text-align: left;}
`}</style> `}</style>
<div className="clearfix edu-txt-center mb10" style={{color:"#333333",fontSize: '15px'}}>学生将得到一次重新答题的机会现有的答题情况将被清空</div> <div className="clearfix edu-txt-center mb10" style={{color:"#333333",fontSize: '15px'}}>学生将得到一次重新答题的机会现有的答题情况将被清空</div>
<ul className="clearfix edu-txt-center ml35"> <ul className="clearfix edu-txt-center ml35">
<li className="fl paddingleft22 fontlefts" style={{width:'160px'}}>姓名</li> <li className="fl paddingleft22 fontlefts" style={{width:'160px'}}>姓名</li>
@ -183,7 +219,7 @@ class Ecerciseallbackagain extends Component{
</ul> </ul>
{datalist===undefined?"": {datalist===undefined?"":
<ul className="upload_select_box fl clearfix mt10 mb10" style={{"overflow-y":"auto",height: "217px"}} <ul className="upload_select_box fl clearfix mt10 mb10 newupload_select_box" style={{"overflow-y":"auto"}}
id="search_not_members_list" id="search_not_members_list"
onScroll={this.contentViewScroll} onScroll={this.contentViewScroll}
> >
@ -191,7 +227,7 @@ class Ecerciseallbackagain extends Component{
{ datalist.map((item,key)=>{ { datalist.map((item,key)=>{
return( return(
<div className="clearfix edu-txt-center lineh-40" key={key}> <div className="clearfix edu-txt-center lineh-40 eerxisbox" key={key}>
<li className="fl" style={{width: '158px'}}> <li className="fl" style={{width: '158px'}}>
<Checkbox <Checkbox
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left"
@ -199,8 +235,12 @@ class Ecerciseallbackagain extends Component{
value={item.user_id} value={item.user_id}
key={item.user_id} key={item.user_id}
> >
<label style={{"textAlign": "left", "color": "#05101A"}} <a style={{"textAlign": "left"}}
className="task-hide color-grey-name" title="frerere">{item.user_name}</label> className="task-hide color-grey-name"
href={`/users/${item.user_id}/courses`}
target={'_blank'}
title={item.user_name}
>{item.user_name}</a>
</Checkbox> </Checkbox>
</li> </li>
<li className="fl" style={{width: '150px'}}> <li className="fl" style={{width: '150px'}}>

@ -421,6 +421,7 @@ class ShixunWorkReport extends Component {
jumptopic={this.jumptopic} jumptopic={this.jumptopic}
getdatalist={()=>this.getdatalist()} getdatalist={()=>this.getdatalist()}
setupdalist={(challenge_score,overall_appraisal,work_score)=>this.setupdalist(challenge_score,overall_appraisal,work_score)} setupdalist={(challenge_score,overall_appraisal,work_score)=>this.setupdalist(challenge_score,overall_appraisal,work_score)}
showAppraiseModal={(sum)=>this.showAppraiseModal(sum)}
/> />
</div> </div>

@ -273,7 +273,7 @@ class ShixunWorkModal extends Component{
</div> </div>
: :
<ul className="upload_select_box fl clearfix mt10 mb10" tyle={{"overflow-y":"auto"}}id="search_not_members_list" <ul className="upload_select_box fl clearfix mt10 mb10" style={{"overflow-y":"auto"}} id="search_not_members_list"
onScroll={this.contentViewScroll} onScroll={this.contentViewScroll}
> >
@ -286,7 +286,7 @@ class ShixunWorkModal extends Component{
group_list&&group_list.length===0?"":group_list.map((item,key)=>{ group_list&&group_list.length===0?"":group_list.map((item,key)=>{
return( return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl task-hide" style={{width: '240px'}}> <li className="fl task-hide" style={{width: '240px',paddingLeft: '10px'}}>
<Checkbox <Checkbox
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left"
name="shixun_homework[]" name="shixun_homework[]"
@ -294,7 +294,7 @@ class ShixunWorkModal extends Component{
key={item=== undefined?"":item.id} key={item=== undefined?"":item.id}
> >
<label style={{"textAlign": "left", "color": "#05101A"}} <label style={{"textAlign": "left", "color": "#05101A"}}
className="task-hide color-grey-name" title="frerere">{item===undefined?"":item.name}</label> className="task-hide color-grey-name" title={item===undefined?"":item.name}>{item===undefined?"":item.name}</label>
</Checkbox> </Checkbox>
</li> </li>
<li className="fl" style={{width: '100px'}}> <li className="fl" style={{width: '100px'}}>

@ -196,6 +196,19 @@ class OfficialAcademicTranscript extends Component {
// min={0} max={record.game_scores.game_score_full} // min={0} max={record.game_scores.game_score_full}
/></a> /></a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/} {/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span>
),
},{
title: '操作',
key: 'operation',
dataIndex: 'operation',
render: (text, record) => (
<span>
<a
className=" color-blue font-14 fr mr22"
onClick={()=>this.props.showAppraiseModal(1)}
>评阅</a>
</span> </span>
), ),
}]; }];
@ -210,6 +223,13 @@ class OfficialAcademicTranscript extends Component {
} }
} }
) )
columns.some((item,key)=> {
if (item.title === "操作") {
columns.splice(key, 1)
return true
}
}
)
} }
return ( return (
<div> <div>
@ -276,6 +296,9 @@ class OfficialAcademicTranscript extends Component {
.linhe15{ .linhe15{
line-height: 15px; line-height: 15px;
} }
.mr22{
margin-right: 22px;
}
`} `}
</style> </style>
{datas===undefined?"":<Table {datas===undefined?"":<Table

@ -12,7 +12,6 @@
width: 100%; width: 100%;
height:150px; height:150px;
border:none; border:none;
padding: 10px;
display: block; display: block;
} }
@ -26,12 +25,9 @@
height: auto; height: auto;
border: 1px solid rgba(234,234,234,1); border: 1px solid rgba(234,234,234,1);
border-radius: 0.125rem; border-radius: 0.125rem;
margin: 0.31rem; margin: 10px 10px 0px 10px;
padding: 0.19rem; padding: 10px 10px 5px 10px
backgroud:rgba(234,234,234,1); backgroud:rgba(234,234,234,1);
padding-bottom: 10px;
padding-right: 10px;
} }
.WordNumberTextarea-count { .WordNumberTextarea-count {
display: inline-block; display: inline-block;

@ -518,7 +518,7 @@ class DetailCardsEditAndAdd extends Component{
style={{"width":"298px"}} style={{"width":"298px"}}
name="shixun_homework[]" name="shixun_homework[]"
> >
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title="frerere">{item.shixun_name}</label> <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox> </Checkbox>
</li> </li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li> <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>

@ -554,7 +554,7 @@ class DetailCardsEditAndEdit extends Component{
style={{"width":"298px"}} style={{"width":"298px"}}
name="shixun_homework[]" name="shixun_homework[]"
> >
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title="frerere">{item.shixun_name}</label> <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox> </Checkbox>
</li> </li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li> <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>

@ -460,7 +460,7 @@ class PathDetailIndex extends Component{
<div className="edu-back-white myProgress padding40-20 mb10"> <div className="edu-back-white myProgress padding40-20 mb10">
<p className="mb20"> <p className="mb20">
<span className="font-16 mr10">关卡数</span> <span className="font-16 mr10">关卡数</span>
<Tooltip placement="bottom" title="已通过数/总关卡数"> <Tooltip placement="bottom" title="已通过关卡数/总关卡数">
<span className="color-green" >{progress.my_score} / {progress.all_score}</span> <span className="color-green" >{progress.my_score} / {progress.all_score}</span>
</Tooltip> </Tooltip>
</p> </p>

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ShixunWorkComment, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save