fix: app_count of dataset is error when apps was deleted (#4810)

This commit is contained in:
DomKing 2024-05-30 19:23:46 +08:00 committed by GitHub
parent 4308a79e89
commit 38a470a873
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,8 @@ class Dataset(db.Model):
@property @property
def app_count(self): def app_count(self):
return db.session.query(func.count(AppDatasetJoin.id)).filter(AppDatasetJoin.dataset_id == self.id).scalar() return db.session.query(func.count(AppDatasetJoin.id)).filter(AppDatasetJoin.dataset_id == self.id,
App.id == AppDatasetJoin.app_id).scalar()
@property @property
def document_count(self): def document_count(self):