From 121d8f39c1453d10736d97844ef0d86ed2cafce6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 11 May 2023 21:44:40 +0300 Subject: [PATCH] Fixed for count --- slpkg/repo_info.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/slpkg/repo_info.py b/slpkg/repo_info.py index 53bda444..1cacc77e 100644 --- a/slpkg/repo_info.py +++ b/slpkg/repo_info.py @@ -7,7 +7,8 @@ from slpkg.configs import Configs from slpkg.utilities import Utilities from slpkg.repositories import Repositories from slpkg.models.models import session as Session -from slpkg.models.models import LastRepoUpdated, SBoTable, BinariesTable +from slpkg.models.models import (LastRepoUpdated, SBoTable, + PonceTable, BinariesTable) class RepoInfo(Configs): @@ -38,11 +39,15 @@ class RepoInfo(Configs): self.print_the_repositories_information() def count_the_packages(self, repository: str) -> int: + sbo_table: dict = { + self.repos.sbo_repo_name: SBoTable, + self.repos.ponce_repo_name: PonceTable + } if self.utils.is_binary_repo(repository): count = self.session.query(BinariesTable).where( BinariesTable.repo == repository).count() else: - count = self.session.query(SBoTable.id).count() + count = self.session.query(sbo_table[repository].id).count() self.total_packages += count