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

dev_hjm
hjm 6 years ago
commit f8c7f1eaa2

@ -151,7 +151,7 @@ class ChallengesController < ApplicationController
def index
uid_logger("identifier: #{params}")
@challenges = Challenge.fields_for_list.where(shixun_id: @shixun.id)
@challenges = @shixun.challenges.fields_for_list
@editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员
@user = current_user

@ -1459,7 +1459,8 @@ class HomeworkCommonsController < ApplicationController
if game_codes.count > 0
code_rate += game_codes.map(&:rate).sum / challenge.path.split("").length
end
target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
logger.info("#####game_codes: #{game_codes}")
#target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
# 作品完成时间
game = challenge.games.find_by(user_id: @user.id)
end_time = game.end_time
@ -1467,7 +1468,7 @@ class HomeworkCommonsController < ApplicationController
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
# 抄袭用户
copy_user = User.find_by_id(game_codes[0].target_user_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?
# 代码部分
code_list = []
@ -1477,7 +1478,7 @@ class HomeworkCommonsController < ApplicationController
code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content}
end
end
# TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。
{code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score,
all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name),
username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position,

@ -1,7 +1,6 @@
class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难
# show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4
default_scope { order("challenges.position asc") }
belongs_to :shixun, :touch => true, counter_cache: true
belongs_to :user

@ -5,7 +5,7 @@ class Shixun < ApplicationRecord
# hide_code 隐藏代码窗口
# code_hidden: 隐藏代码目录
# task_pass: 跳关
has_many :challenges, dependent: :destroy
has_many :challenges, -> {order("challenges.position asc")}, dependent: :destroy
has_many :challenge_tags, through: :challenges
has_many :myshixuns, :dependent => :destroy
has_many :shixun_members, dependent: :destroy

@ -1,12 +1,15 @@
.edu-class-container {
width: 1200px;
margin: 10px auto 20px;
}
#forum_index_list {
margin-top: 90px;
margin-bottom: 320px;
}
.uploadBtn {
margin-left: 0px;
.edu-class-container {
width: 1200px;
margin: 10px auto 20px;
}
#forum_index_list {
margin-top: 90px;
margin-bottom: 320px;
}
#yslforum_index_list {
margin-top: 20px;
margin-bottom: 320px;
}
.uploadBtn {
margin-left: 0px;
}

@ -526,7 +526,7 @@ class TopicDetail extends Component {
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
return (
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="forum_index_list"> {/* fl with100 */}
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="yslforum_index_list"> {/* fl with100 */}
<style>{`
.topicDetail #forum_list .return_btn.no_mr {
margin-right: 1px;

@ -71,13 +71,13 @@ class ShixunWorkDetails extends Component {
<div className="educontent">
<p className="clearfix mt20">
<a className="fl color-grey-9 btn colorgrey hovercolorblue"
onClick={()=>this.goback(1)}
href={`/courses/${data&&data.course_id}/shixun_homeworks/${data&&data.homework_common_id}`}
>
<span className={"color-grey-9"}>{data&&data.course_name}123</span>
<a className={"color-grey-9"} >{data&&data.course_name}</a>
</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className="btn colorgrey fl hovercolorblue grey"
onClick={this.goback}
href={`/courses/${data&&data.course_id}/shixun_homeworks/${data&&data.homework_common_id}/list?tab=0`}
// to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}
>
<span className={"color-grey-9"}>实训作业</span>

@ -28,10 +28,10 @@ class ShixunCustomsPass extends Component {
datas.push({
customs:{position:item.position,subject:item.subject},
taskname:{name:item.username},
openingtime:moment(item.end_time).format('YYYY-MM-DD HH:mm:ss'),
openingtime:item.end_time===null?"无":item.end_time===undefined?"无":item.end_time===""?"无":moment(item.end_time).format('YYYY-MM-DD HH:mm:ss'),
evaluating: {final_score:item.final_score,all_score:item.all_score},
finishtime:item.copy_username,
elapsedtime:moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
empvalue:item.code_rate,
// adjustmentminute:asdasd
})
@ -200,6 +200,9 @@ class ShixunCustomsPass extends Component {
</style>
{
data&&data.challenge_list.map((item,key)=>{
// console.log("203challenge_list下面的数据");
// console.log(item);
// console.log(JSON.stringify(item));
return(
<div key={key} className={"mb20"}>
<div className="font-16 color-dark-21 ml20 mr20">
@ -213,46 +216,46 @@ class ShixunCustomsPass extends Component {
<span className={"font-14"}>{item.subject}</span>
</a>
</span>
<span className="fr codeboxright">代码文件{item.code_list[0].path}</span>
<span className="fr codeboxright">代码文件{item.code_list.length===0?"无":item.code_list[0].path===undefined?"无":item.code_list[0].path}</span>
</p>
</div>
{item.code_list.map((ite,k)=>{
{item.code_list.length===0?"":item.code_list.map((ite,k)=>{
return(
<div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15">
<p className="clearfix pt5 pb5 codebox">
<span className="fl">
<span className={"colorC8161D"}>{item.username}</span>
的代码文件
</span>
<span className="fr">
<span className={"color-green"}>{item.copy_username}</span>
的代码文件
</span>
</p>
<style>
{`
.borderccc{
border:1px solid #ccc
}
`}
</style>
<div className="test-code mt20 borderccc">
<li className="clearfix">
<MonacoDiffEditor
height="500"
// language="javascript"
original={ite.origin_content}
value={ ite.target_content}
// options={options}
/>
</li>
</div>
</div>
</div>
<div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15">
<p className="clearfix pt5 pb5 codebox">
<span className="fl">
<span className={"colorC8161D"}>{item.username}</span>
的代码文件
</span>
<span className="fr">
<span className={"color-green"}>{item.copy_username}</span>
的代码文件
</span>
</p>
<style>
{`
.borderccc{
border:1px solid #ccc
}
`}
</style>
<div className="test-code mt20 borderccc">
<li className="clearfix">
<MonacoDiffEditor
height="500"
// language="javascript"
original={ite.origin_content}
value={ ite.target_content}
// options={options}
/>
</li>
</div>
</div>
</div>
)
})}
</div>
@ -267,4 +270,4 @@ class ShixunCustomsPass extends Component {
}
}
export default ShixunCustomsPass;
export default ShixunCustomsPass;

Loading…
Cancel
Save