From cde584b027cd3ddebfc101a256d6b07f85b6bd49 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Fri, 13 Mar 2020 17:08:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E8=A7=82?= =?UTF-8?q?=E7=9C=8B=E7=BB=93=E6=9D=9F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/create_watch_video_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/create_watch_video_service.rb b/app/services/create_watch_video_service.rb index afdd57b5b..9432c65bc 100644 --- a/app/services/create_watch_video_service.rb +++ b/app/services/create_watch_video_service.rb @@ -31,7 +31,9 @@ class CreateWatchVideoService < ApplicationService if watch_course_video.present? && !watch_course_video.is_finished && watch_course_video.watch_duration < params[:watch_duration].to_f # 更新课程视频的时长及是否看完状态 watch_course_video.watch_duration = params[:watch_duration] - watch_course_video.is_finished = (watch_course_video.duration <= params[:watch_duration].to_f) + if params[:ed].present? + watch_course_video.is_finished = watch_course_video.watch_video_histories.sum(:total_duration) >= watch_course_video.duration + end watch_course_video.end_at = current_time watch_course_video.save! end