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

courseware
杨树明 5 years ago
commit b805ba2a38

@ -99,7 +99,7 @@ class CoursesController < ApplicationController
limit = params[:limit] || 16
@courses = @courses.page(page).per(limit)
@courses = @courses.preload(:school, :none_hidden_course_modules, :teacher_users, teacher: :user_extension)
@courses = @courses.preload(:school, :none_hidden_course_modules, teacher: :user_extension)
end
def course_videos

@ -11,7 +11,7 @@ class HomeworkCommonsController < ApplicationController
before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results,
:code_review_detail, :show_comment, :settings, :works_list, :update_settings,
:reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation,
:update_score, :update_student_score, :batch_comment]
:update_score, :update_student_score, :batch_comment, :get_next_work]
before_action :user_course_identity
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer,
:update_student_score]
@ -287,6 +287,15 @@ class HomeworkCommonsController < ApplicationController
end
end
def get_next_work
member = @course.course_member(current_user.id)
student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2]))
if params[:work_id]
student_works = student_works.where.not(id: params[:work_id])
end
@work = student_works.where("work_status > 0").take
end
def update_score
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
@homework.update_homework_work_score

@ -18,7 +18,8 @@ class MyshixunsController < ApplicationController
# 强制重置实训
# 前段需要按照操作过程提示
def reset_my_game
unless (current_user.admin? || current_user.id == @myshixun.user_id)
course = Course.find_by(id: params[:course_id])
unless (current_user.admin_or_business? || current_user.id == @myshixun.user_id) || (course.present? && current_user.course_identity(course) < Course::STUDENT)
tip_exception("403", "")
end
begin

@ -76,6 +76,7 @@ class Weapps::CoursesController < Weapps::BaseController
def show
@course = current_course
@current_user = current_user
@teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..2]
end
def shixun_homework_category

@ -19,7 +19,7 @@ class Weapps::HomesController < Weapps::BaseController
@courses = @courses.where(id: current_laboratory.all_courses)
@course_count = @courses.count
order_str = "course_members.sticky=1 desc, course_members.sticky_time desc, courses.created_at desc"
@courses = paginate(@courses.order(order_str).includes(:teacher, :school))
@courses = paginate(@courses.order(order_str).includes(:teacher_users, :teacher, :school))
@user = current_user
end
end

@ -13,6 +13,5 @@ json.courses @courses do |course|
json.is_end course.is_end
json.first_category_url module_url(course.none_hidden_course_modules.first, course)
json.excellent course.excellent
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师
end
json.courses_count @courses_count

@ -0,0 +1,2 @@
json.work_id @work&.id
json.user_name @work&.user&.real_name

@ -1,4 +1,5 @@
json.homework_common_id @homework.id
json.course_id @homework.course_id
json.category @homework.category_info
json.course_name @course.name
json.work_id @work.id

@ -1,4 +1,5 @@
json.(@course, :id, :name, :course_members_count, :credit, :invite_code_halt)
json.teachers_count @course.teachers.count
json.students_count @course.students.count
json.course_identity @current_user.course_identity(@course)
json.course_identity @current_user.course_identity(@course)
json.teacher_users @teacher_users

@ -26,5 +26,6 @@ json.courses @courses.each do |course|
course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first
json.sticky course_member.sticky
json.course_identity current_user.course_identity(course)
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师
end

@ -597,6 +597,7 @@ Rails.application.routes.draw do
get :update_score
get :update_student_score
post :batch_comment
get :get_next_work
end
collection do

@ -44,7 +44,9 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
let pos = []//
const log = useCallback((callback, isEnd = false) => {
let params = {}
let params = {
point: el.currentTime.currentTime
}
if (logId) {
params['log_id'] = logId
params['watch_duration'] = getTotalEffectTime(pos) //
@ -137,7 +139,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
log()
}
}
}else {
} else {
lastUpdatedTime = newTime
}
}
@ -177,7 +179,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
el.current.removeEventListener('seeking', onSeeking)
el.current.removeEventListener('seeked', onSeeked)
el.current.removeEventListener('timeupdate', onTimeupdate)
if(el.current.playing) {
if (el.current.playing) {
log()
}
}

Loading…
Cancel
Save