Skip to content

Commit 133db5c

Browse files
committed
enhancement(Video): change rules to be featured
1 parent 3675f86 commit 133db5c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/db/lib/db_schema/video.ex

+4-2
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,16 @@ defmodule DB.Schema.Video do
285285
from(
286286
v in query,
287287
where:
288-
v.is_partner == true or
288+
# Less than 3 days old
289289
v.inserted_at >= datetime_add(^now, -3, "day") or
290+
# Or there are at least 3 comments
290291
v.id in fragment("""
291292
SELECT popular_videos.id
292293
FROM videos popular_videos
293294
INNER JOIN statements ON statements.video_id = popular_videos.id
295+
INNER JOIN comments ON comments.statement_id = statements.id
294296
GROUP BY popular_videos.id
295-
HAVING COUNT(statements.id) >= 3
297+
HAVING COUNT(comments.id) >= 3
296298
""")
297299
)
298300
end)

0 commit comments

Comments
 (0)