diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/videos/stats.ts | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/server/controllers/api/videos/stats.ts b/server/controllers/api/videos/stats.ts index 30e2bb06c..e79f01888 100644 --- a/server/controllers/api/videos/stats.ts +++ b/server/controllers/api/videos/stats.ts | |||
@@ -67,18 +67,9 @@ async function getTimeserieStats (req: express.Request, res: express.Response) { | |||
67 | const stats = await LocalVideoViewerModel.getTimeserieStats({ | 67 | const stats = await LocalVideoViewerModel.getTimeserieStats({ |
68 | video, | 68 | video, |
69 | metric, | 69 | metric, |
70 | startDate: query.startDate ?? buildOneMonthAgo().toISOString(), | 70 | startDate: query.startDate ?? video.createdAt.toISOString(), |
71 | endDate: query.endDate ?? new Date().toISOString() | 71 | endDate: query.endDate ?? new Date().toISOString() |
72 | }) | 72 | }) |
73 | 73 | ||
74 | return res.json(stats) | 74 | return res.json(stats) |
75 | } | 75 | } |
76 | |||
77 | function buildOneMonthAgo () { | ||
78 | const monthAgo = new Date() | ||
79 | monthAgo.setHours(0, 0, 0, 0) | ||
80 | |||
81 | monthAgo.setDate(monthAgo.getDate() - 29) | ||
82 | |||
83 | return monthAgo | ||
84 | } | ||