diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-02-02 12:59:41 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-02-04 09:04:47 +0100 |
commit | 3d4e112d16471703f51a542c0cc6e73a6f5db628 (patch) | |
tree | cb4a53a50f9bc14a87b62ccfa9d398feb4bbcbc8 /server/models/video/video.ts | |
parent | f6267b610145033ee26ca8a4a7c2b97eca65072e (diff) | |
download | PeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.tar.gz PeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.tar.zst PeerTube-3d4e112d16471703f51a542c0cc6e73a6f5db628.zip |
add best trending strategy based on Reddit's best
inspired from https://www.reddit.com/r/changelog/comments/7spgg0/best_is_the_new_hotness/
this implementation only adds freshness, and doesn't personalize based
on subscribed communities yet.
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index ea6c9d44b..0ecb8d600 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1090,7 +1090,9 @@ export class VideoModel extends Model { | |||
1090 | const trendingDays = options.sort.endsWith('trending') | 1090 | const trendingDays = options.sort.endsWith('trending') |
1091 | ? CONFIG.TRENDING.VIDEOS.INTERVAL_DAYS | 1091 | ? CONFIG.TRENDING.VIDEOS.INTERVAL_DAYS |
1092 | : undefined | 1092 | : undefined |
1093 | const hot = options.sort.endsWith('hot') | 1093 | let trendingAlgorithm |
1094 | if (options.sort.endsWith('hot')) trendingAlgorithm = 'hot' | ||
1095 | if (options.sort.endsWith('best')) trendingAlgorithm = 'best' | ||
1094 | 1096 | ||
1095 | const serverActor = await getServerActor() | 1097 | const serverActor = await getServerActor() |
1096 | 1098 | ||
@@ -1120,7 +1122,7 @@ export class VideoModel extends Model { | |||
1120 | user: options.user, | 1122 | user: options.user, |
1121 | historyOfUser: options.historyOfUser, | 1123 | historyOfUser: options.historyOfUser, |
1122 | trendingDays, | 1124 | trendingDays, |
1123 | hot, | 1125 | trendingAlgorithm, |
1124 | search: options.search | 1126 | search: options.search |
1125 | } | 1127 | } |
1126 | 1128 | ||