Merge branch 'dev_aliyun' into dev_cxt

dev_ec
cxt 5 years ago
commit bd24744120

@ -272,7 +272,7 @@ class CoursesController < ApplicationController
@stages = @course.course_stages.includes(:shixuns)
@user = current_user
@myshixuns = @user.myshixuns.where(shixun_id: @course.course_stage_shixuns.pluck(:shixun_id))
@start_learning = @user_course_identity == Course::STUDENT && @course.learning?(current_user.id)
@start_learning = @user_course_identity == Course::STUDENT && @myshixuns.present?
end
def search_course_list

@ -269,8 +269,8 @@ module CoursesHelper
group_info
end
def last_subject_shixun user_id, course
myshixun = Myshixun.where(user_id: user_id, shixun_id: course.shixuns).order("updated_at desc").first
def last_subject_shixun course, myshixuns
myshixun = myshixuns.sort{|x,y| y[:updated_at] <=> x[:updated_at] }.first
return "" unless myshixun
stage_shixun = course.course_stage_shixuns.where(shixun_id: myshixun.shixun_id).take
progress = stage_shixun&.course_stage&.position.to_s + "-" + stage_shixun&.position.to_s + " " + myshixun.shixun&.name

@ -354,9 +354,8 @@ class Course < ApplicationRecord
Myshixun.where(user_id: user_id, shixun_id: shixuns).exists?
end
def my_subject_progress
my_challenge_count = Game.joins(:challenge).where(user_id: User.current.id, status: 2, challenges: {shixun_id: shixuns.published_closed}).
pluck(:challenge_id).uniq.size
def my_subject_progress myshixuns
my_challenge_count = Game.where(myshixun_id: myshixuns.pluck(:id), status: 2).pluck(:challenge_id).uniq.size
course_challeng_count = shixuns.pluck(:challenges_count).sum
count = course_challeng_count == 0 ? 0 : ((my_challenge_count.to_f / course_challeng_count).round(2) * 100).to_i
end

@ -7,6 +7,6 @@ end
json.start_learning @start_learning
json.subject_id @subject.id
json.learned @start_learning ? @course.my_subject_progress : 0
json.learned @start_learning ? @course.my_subject_progress(@myshixuns) : 0
json.last_shixun @start_learning ? last_subject_shixun(@user.id, @course) : ""
json.last_shixun @start_learning ? last_subject_shixun(@course, @myshixuns) : ""

@ -151,7 +151,7 @@ class Repository extends Component {
</p>
</div>
<p className="inviteTipbtn with100"><a
onClick={() => { $('#repository_url_tip').hide(); }}>知道了</a></p>
onClick={() => { $('#repository_url_tip').css('display') === 'none'}}>知道了</a></p>
</div>
</a>

@ -92,7 +92,7 @@ class RepositoryAddFile extends Component {
if(!value){
callback('文件名不能为空');
}else if (value == "/" || value.indexOf('.') == -1 ) {
callback('请输入正确的文件路径src/HelloWord.java');
callback('请输入正确的文件路径src/HelloWorld.java');
}else{
callback();
}
@ -162,7 +162,7 @@ class RepositoryAddFile extends Component {
validator:this.checkPath
}]
})(
<Input placeholder="输入文件路径名src/HelloWord.java" className="winput-300-35 fl"/>
<Input placeholder="输入文件路径名src/HelloWorld.java" className="winput-300-35 fl"/>
)}
</Form.Item>
</div>

Loading…
Cancel
Save