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

courseware
杨树明 5 years ago
commit ccaa31b10c

@ -16,11 +16,11 @@ class CreateWatchVideoService < ApplicationService
if params[:log_id].present?
watch_video_history = user.watch_video_histories.find(params[:log_id])
if params[:total_duration] < params[:watch_duration]
return watch_video_history
end
# if params[:total_duration] < params[:watch_duration]
# return watch_video_history
# end
# 更新观看时长
if watch_video_history.present? && !watch_video_history.is_finished && watch_video_history.watch_duration <= params[:watch_duration] && watch_video_history.total_duration <= params[:total_duration]
if watch_video_history.present? && !watch_video_history.is_finished && watch_video_history.total_duration <= params[:total_duration]
# 如果观看总时长没变,说明视频没有播放,无需再去记录
watch_video_history.end_at = current_time
watch_video_history.total_duration = params[:total_duration]
@ -49,7 +49,9 @@ class CreateWatchVideoService < ApplicationService
if !watch_course_video.is_finished
# 更新课程视频的时长及是否看完状态
watch_course_video.watch_duration = params[:watch_duration] if watch_course_video.watch_duration < params[:watch_duration]
watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration if params[:ed].present?
if params[:ed].present? || (watch_course_video.duration >= 300 && (watch_course_video.duration - params[:point].to_i) <= 20)
watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration
end
end
watch_course_video.save!
end

@ -45,7 +45,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
const log = useCallback((callback, isEnd = false) => {
let params = {
point: el.currentTime.currentTime
point: el.current.currentTime
}
if (logId) {
params['log_id'] = logId

@ -397,7 +397,7 @@ class TPMIndex extends Component {
newathArray:list
})
}
render() {
render() {
let url = window.location.href;
let flag =false;
@ -671,7 +671,7 @@ class TPMIndex extends Component {
</div>
);
}
}
}
export default SnackbarHOC() (TPMIndexHOC ( TPMIndex ));

Loading…
Cancel
Save