feed: сортировка 'Чистая лента' (шум changelog/lапша/wiki выпилен), футер с @AlStack вместо гита
This commit is contained in:
@@ -216,9 +216,22 @@ def browse2(q="", names=None, limit=60, offset=0, sort="score", priced=False, ty
|
||||
if typ and typ != "all":
|
||||
where += "AND (',' || COALESCE(types,'') || ',') LIKE ? "
|
||||
args += [f"%,{typ},%"]
|
||||
if sort == "quality":
|
||||
# Чистая лента: выкидываем шум до сортировки — длинные склейки-«лапши»,
|
||||
# короткие хайповые куски, сервисный мусор (wiki/docs/changelog/chapterlist),
|
||||
# и записи без даты и без текста.
|
||||
where += """AND length(COALESCE(title,'')) BETWEEN 8 AND 220
|
||||
AND title NOT GLOB '*[[]Chapter List*' AND title NOT LIKE '%||%||%'
|
||||
AND lower(COALESCE(title,'')) NOT LIKE '%changelog%'
|
||||
AND lower(COALESCE(title,'')) NOT LIKE '%release notes%'
|
||||
AND lower(COALESCE(title,'')) NOT LIKE '%documentation%'
|
||||
AND (COALESCE(text,'') = '' OR length(text) <= 4000 OR length(title) >= 25)
|
||||
AND (published IS NOT NULL AND published != '' OR length(COALESCE(text,'')) >= 60)
|
||||
"""
|
||||
order = {"fresh": "ORDER BY published DESC, id DESC",
|
||||
"price": "ORDER BY CAST(price AS REAL) DESC, score DESC",
|
||||
"old": "ORDER BY published ASC, id ASC"}.get(sort, "ORDER BY score DESC, id DESC")
|
||||
"old": "ORDER BY published ASC, id ASC",
|
||||
"quality": "ORDER BY score DESC, id DESC"}.get(sort, "ORDER BY score DESC, id DESC")
|
||||
with db() as c:
|
||||
total = c.execute("SELECT COUNT(*) FROM items " + where, args).fetchone()[0]
|
||||
rows = c.execute("SELECT id,provider,kind,source,title,text,author,published,score,price,currency,url,types "
|
||||
|
||||
Reference in New Issue
Block a user