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 def index
uid_logger("identifier: #{params}") 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有判断权限如果没发布则肯定是管理人员 @editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员
@user = current_user @user = current_user

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

@ -1,7 +1,6 @@
class Challenge < ApplicationRecord class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难 # difficulty: 关卡难度: 1.简单 2.中等 3.困难
# show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4 # 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 :shixun, :touch => true, counter_cache: true
belongs_to :user belongs_to :user

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

@ -6,7 +6,10 @@
margin-top: 90px; margin-top: 90px;
margin-bottom: 320px; margin-bottom: 320px;
} }
#yslforum_index_list {
margin-top: 20px;
margin-bottom: 320px;
}
.uploadBtn { .uploadBtn {
margin-left: 0px; margin-left: 0px;
} }

@ -526,7 +526,7 @@ class TopicDetail extends Component {
const courseId=this.props.match.params.coursesId; const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId const boardId = this.props.match.params.boardId
return ( 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>{` <style>{`
.topicDetail #forum_list .return_btn.no_mr { .topicDetail #forum_list .return_btn.no_mr {
margin-right: 1px; margin-right: 1px;

@ -71,13 +71,13 @@ class ShixunWorkDetails extends Component {
<div className="educontent"> <div className="educontent">
<p className="clearfix mt20"> <p className="clearfix mt20">
<a className="fl color-grey-9 btn colorgrey hovercolorblue" <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> </a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className="btn colorgrey fl hovercolorblue grey" <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} // to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}
> >
<span className={"color-grey-9"}>实训作业</span> <span className={"color-grey-9"}>实训作业</span>

@ -28,10 +28,10 @@ class ShixunCustomsPass extends Component {
datas.push({ datas.push({
customs:{position:item.position,subject:item.subject}, customs:{position:item.position,subject:item.subject},
taskname:{name:item.username}, 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}, evaluating: {final_score:item.final_score,all_score:item.all_score},
finishtime:item.copy_username, 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, empvalue:item.code_rate,
// adjustmentminute:asdasd // adjustmentminute:asdasd
}) })
@ -200,6 +200,9 @@ class ShixunCustomsPass extends Component {
</style> </style>
{ {
data&&data.challenge_list.map((item,key)=>{ data&&data.challenge_list.map((item,key)=>{
// console.log("203challenge_list下面的数据");
// console.log(item);
// console.log(JSON.stringify(item));
return( return(
<div key={key} className={"mb20"}> <div key={key} className={"mb20"}>
<div className="font-16 color-dark-21 ml20 mr20"> <div className="font-16 color-dark-21 ml20 mr20">
@ -213,46 +216,46 @@ class ShixunCustomsPass extends Component {
<span className={"font-14"}>{item.subject}</span> <span className={"font-14"}>{item.subject}</span>
</a> </a>
</span> </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> </p>
</div> </div>
{item.code_list.map((ite,k)=>{ {item.code_list.length===0?"":item.code_list.map((ite,k)=>{
return( return(
<div className="font-16 color-dark-21 ml20 mr20" key={k}> <div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15"> <div className=" mt15">
<p className="clearfix pt5 pb5 codebox"> <p className="clearfix pt5 pb5 codebox">
<span className="fl"> <span className="fl">
<span className={"colorC8161D"}>{item.username}</span> <span className={"colorC8161D"}>{item.username}</span>
的代码文件 的代码文件
</span> </span>
<span className="fr"> <span className="fr">
<span className={"color-green"}>{item.copy_username}</span> <span className={"color-green"}>{item.copy_username}</span>
的代码文件 的代码文件
</span> </span>
</p> </p>
<style> <style>
{` {`
.borderccc{ .borderccc{
border:1px solid #ccc border:1px solid #ccc
} }
`} `}
</style> </style>
<div className="test-code mt20 borderccc"> <div className="test-code mt20 borderccc">
<li className="clearfix"> <li className="clearfix">
<MonacoDiffEditor <MonacoDiffEditor
height="500" height="500"
// language="javascript" // language="javascript"
original={ite.origin_content} original={ite.origin_content}
value={ ite.target_content} value={ ite.target_content}
// options={options} // options={options}
/> />
</li> </li>
</div> </div>
</div> </div>
</div> </div>
) )
})} })}
</div> </div>

Loading…
Cancel
Save