fix 课程视频时长

PCqiandao
anke1460 5 years ago
parent 411eb77ce3
commit 80aa7c0770

@ -38,9 +38,9 @@ class CreateWatchVideoService < ApplicationService
end
else
# 开始播放时记录一次
if params[:course_video_id].present?
if params[:course_id].present?
# 课堂视频
course_video = CourseVideo.find(params[:course_video_id])
course_video = CourseVideo.find_by(video_id: params[:video_id], course_id: params[:course_id])
watch_course_video = WatchCourseVideo.find_or_initialize_by(course_video_id: course_video.id, user_id: user.id) do |d|
d.start_at = current_time
d.duration = params[:duration]
@ -52,7 +52,7 @@ class CreateWatchVideoService < ApplicationService
watch_course_video.save! unless watch_course_video.persisted?
else
# 非课堂视频
video = Video.find_by(params[:video_id])
video = Video.find(params[:video_id])
watch_video_history = build_video_log(current_time, video.id)
watch_video_history.save!
end

Loading…
Cancel
Save