diff --git a/src/app/home/course/course.page.ts b/src/app/home/course/course.page.ts index 137ec5c..e4f89b1 100644 --- a/src/app/home/course/course.page.ts +++ b/src/app/home/course/course.page.ts @@ -250,15 +250,15 @@ export class CoursePage implements OnInit, AfterViewInit, OnDestroy { duration: 0 }; this.lastPlayedVideoKey = Object.values(history).map(h => h.video_id).sort((a, b) => { - // force history[b].updated_at to be a string + // force history[b].played_at to be a string // @ts-ignore - return ('' + history[b].updated_at).localeCompare(history[a].updated_at); + return ('' + history[b].played_at).localeCompare(history[a].played_at); }).slice(0, 1)[0] ?? null; const videoInfo = Object.values(videos).map(lecture => { lecture.history = history[lecture.id] ?? ((lecture.id in evaluations && lecture.duration) ? { // If evaluation exists, treat as watched end_time: lecture.duration, - updated_at: null, - } : {end_time: null, updated_at: null}); + played_at: null, + } : {end_time: null, played_at: null}); if (lecture.duration) { progress.duration -= -lecture.duration; if (lecture.history.end_time) { diff --git a/src/app/man.service.ts b/src/app/man.service.ts index 24df606..76c9ee8 100644 --- a/src/app/man.service.ts +++ b/src/app/man.service.ts @@ -112,7 +112,7 @@ export class ManService { const records = data?.records ?? {}; if (update) { if (!records[update.video_id] || - (records[update.video_id].updated_at < update.updated_at)) { + (records[update.video_id].played_at < update.played_at)) { records[update.video_id] = update; } } @@ -211,7 +211,7 @@ export interface CourseListResponse { }[]; }; last_fetched_at: string; - last_played: { video: Lecture, updated_at: string, end_time: number } | null; + last_played: { video: Lecture, played_at: string, end_time: number } | null; } export interface EvaluationRecord { diff --git a/src/app/play-tracker.service.ts b/src/app/play-tracker.service.ts index eafb561..a879b03 100644 --- a/src/app/play-tracker.service.ts +++ b/src/app/play-tracker.service.ts @@ -1,5 +1,5 @@ import {inject, Injectable} from '@angular/core'; -import {first, map, mergeMap, switchMap, tap} from 'rxjs/operators'; +import {first, map, switchMap, tap} from 'rxjs/operators'; import {fromEventPattern, Observable} from 'rxjs'; import {FieldValue, Timestamp} from '@angular/fire/firestore'; import Pusher from 'pusher-js'; @@ -61,7 +61,7 @@ export interface PlayHistory { export interface PlayHistoryValue { duration?: number | null; end_time: number; - updated_at: Timestamp | FieldValue; + played_at: Timestamp | FieldValue; video_id?: number; year?: string; course?: string;