Skip to content

Commit f5f0b26

Browse files
fix: change updated_at to played_at (#45)
* fix: change updated_at to played_at * refactor: remove updated_at in CourseListResponse type definition --------- Co-authored-by: Siwat T. <keen@keendev.net>
1 parent 5152831 commit f5f0b26

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/app/home/course/course.page.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,15 @@ export class CoursePage implements OnInit, AfterViewInit, OnDestroy {
250250
duration: 0
251251
};
252252
this.lastPlayedVideoKey = Object.values(history).map(h => h.video_id).sort((a, b) => {
253-
// force history[b].updated_at to be a string
253+
// force history[b].played_at to be a string
254254
// @ts-ignore
255-
return ('' + history[b].updated_at).localeCompare(history[a].updated_at);
255+
return ('' + history[b].played_at).localeCompare(history[a].played_at);
256256
}).slice(0, 1)[0] ?? null;
257257
const videoInfo = Object.values(videos).map(lecture => {
258258
lecture.history = history[lecture.id] ?? ((lecture.id in evaluations && lecture.duration) ? { // If evaluation exists, treat as watched
259259
end_time: lecture.duration,
260-
updated_at: null,
261-
} : {end_time: null, updated_at: null});
260+
played_at: null,
261+
} : {end_time: null, played_at: null});
262262
if (lecture.duration) {
263263
progress.duration -= -lecture.duration;
264264
if (lecture.history.end_time) {

src/app/man.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class ManService {
112112
const records = data?.records ?? {};
113113
if (update) {
114114
if (!records[update.video_id] ||
115-
(records[update.video_id].updated_at < update.updated_at)) {
115+
(records[update.video_id].played_at < update.played_at)) {
116116
records[update.video_id] = update;
117117
}
118118
}
@@ -211,7 +211,7 @@ export interface CourseListResponse {
211211
}[];
212212
};
213213
last_fetched_at: string;
214-
last_played: { video: Lecture, updated_at: string, end_time: number } | null;
214+
last_played: { video: Lecture, played_at: string, end_time: number } | null;
215215
}
216216

217217
export interface EvaluationRecord {

src/app/play-tracker.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {inject, Injectable} from '@angular/core';
2-
import {first, map, mergeMap, switchMap, tap} from 'rxjs/operators';
2+
import {first, map, switchMap, tap} from 'rxjs/operators';
33
import {fromEventPattern, Observable} from 'rxjs';
44
import {FieldValue, Timestamp} from '@angular/fire/firestore';
55
import Pusher from 'pusher-js';
@@ -61,7 +61,7 @@ export interface PlayHistory {
6161
export interface PlayHistoryValue {
6262
duration?: number | null;
6363
end_time: number;
64-
updated_at: Timestamp | FieldValue;
64+
played_at: Timestamp | FieldValue;
6565
video_id?: number;
6666
year?: string;
6767
course?: string;

0 commit comments

Comments
 (0)