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 17, 2023
1 parent f598c55 commit 8e9d89a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ 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 8e9d89a

Please sign in to comment.