aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-01-28 14:43:02 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-01-28 15:55:34 +0100
commit923d3d5ad53cd23bf8107e936408e321f6175517 (patch)
tree74babf4757aecf3890cb794a6315221f8e1bafae /server
parentba5d4a849c7d7ba05f093480ae12286c4af61556 (diff)
downloadPeerTube-923d3d5ad53cd23bf8107e936408e321f6175517.tar.gz
PeerTube-923d3d5ad53cd23bf8107e936408e321f6175517.tar.zst
PeerTube-923d3d5ad53cd23bf8107e936408e321f6175517.zip
add test and openapi for hot sort parameter
Diffstat (limited to 'server')
-rw-r--r--server/models/video/video-query-builder.ts4
-rw-r--r--server/tests/api/videos/single-server.ts8
2 files changed, 11 insertions, 1 deletions
diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts
index 3f31ac862..e2145fb9a 100644
--- a/server/models/video/video-query-builder.ts
+++ b/server/models/video/video-query-builder.ts
@@ -262,7 +262,9 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions)
262 * justify a better score. However there are multiple ways to achieve that 262 * justify a better score. However there are multiple ways to achieve that
263 * goal, which is left for later. Yes, this is a TODO :) 263 * goal, which is left for later. Yes, this is a TODO :)
264 * 264 *
265 * note: weights and base score are in number of half-days. 265 * notes:
266 * - weights and base score are in number of half-days.
267 * - all comments are counted, regardless of being written by the video author or not
266 * see https://github.com/reddit-archive/reddit/blob/master/r2/r2/lib/db/_sorts.pyx#L47-L58 268 * see https://github.com/reddit-archive/reddit/blob/master/r2/r2/lib/db/_sorts.pyx#L47-L58
267 */ 269 */
268 const weights = { 270 const weights = {
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index b74bc3e80..52c6800c1 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -355,6 +355,14 @@ describe('Test a single server', function () {
355 expect(videos.length).to.equal(2) 355 expect(videos.length).to.equal(2)
356 }) 356 })
357 357
358 it('Should list and sort by hotness in descending order', async function () {
359 const res = await getVideosListPagination(server.url, 0, 2, '-hot')
360
361 const videos = res.body.data
362 expect(res.body.total).to.equal(6)
363 expect(videos.length).to.equal(2)
364 })
365
358 it('Should update a video', async function () { 366 it('Should update a video', async function () {
359 const attributes = { 367 const attributes = {
360 name: 'my super video updated', 368 name: 'my super video updated',