Skip to content

Commit

Permalink
VID-690: Ignore the zero length session for time watched
Browse files Browse the repository at this point in the history
  • Loading branch information
dthies committed Aug 30, 2023
1 parent ca1a6a5 commit 3a623b5
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@ public function get_fields(): array {

if (videotime_has_repository()) {
$addfields = [
new field('watched_time', new lang_string('watchedtime', 'videotime'), $this, 'MAX(current_watch_time)', [
new field('watched_time', new lang_string('watchedtime', 'videotime'), $this, 'MAX(
CASE WHEN vtn.current_watch_time - vtn.start > 1 THEN vtn.current_watch_time ELSE 0 END
)', [
new time_attribute()
]),
new field('time_left', new lang_string('timeleft', 'videotime'), $this, 'MIN(vvv.duration - current_watch_time)', [
new field('time_left', new lang_string('timeleft', 'videotime'), $this, 'MIN(
CASE WHEN vtn.current_watch_time - vtn.start > 1
THEN vvv.duration - vtn.current_watch_time
ELSE vvv.duration
END
)', [
new time_attribute()
]),
new field('status', new lang_string('activitystatus', 'videotime'), $this, 'MAX(cmc.completionstate)', [
Expand Down

0 comments on commit 3a623b5

Please sign in to comment.