We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e89507 commit 2c43fccCopy full SHA for 2c43fcc
backend/src/module/database/torrent.py
@@ -1,7 +1,7 @@
1
import logging
2
from typing import Optional
3
4
-from sqlmodel import Session, select
+from sqlmodel import Session, select, and_, desc
5
6
from module.models import Torrent
7
@@ -59,5 +59,7 @@ def check_new(self, torrents_list: list[Torrent]) -> list[Torrent]:
59
60
def get_bangumi_id(self, torrent_hash: str) -> Optional[int]:
61
return self.session.exec(
62
- select(Torrent.bangumi_id).where(Torrent.hash == torrent_hash)
+ select(Torrent.bangumi_id)
63
+ .where(and_(Torrent.hash == torrent_hash, Torrent.bangumi_id.isnot(None)))
64
+ .order_by(desc(Torrent.id))
65
).first()
0 commit comments