Skip to content

Commit d2d58af

Browse files
committed
@mbridak Add fetch_exchange1_unique_count
1 parent 676071c commit d2d58af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

not1mm/lib/database.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,23 @@ def fetch_country_count(self) -> dict:
695695
logger.debug("%s", exception)
696696
return {}
697697

698+
def fetch_exchange1_unique_count(self) -> dict:
699+
"""
700+
Fetch count of unique countries
701+
{exch1_count: count}
702+
"""
703+
try:
704+
with sqlite3.connect(self.database) as conn:
705+
conn.row_factory = self.row_factory
706+
cursor = conn.cursor()
707+
cursor.execute(
708+
f"select count(DISTINCT(Exchange1)) as exch1_count from dxlog where Exchange1 != '' and ContestNR = {self.current_contest};"
709+
)
710+
return cursor.fetchone()
711+
except sqlite3.OperationalError as exception:
712+
logger.debug("%s", exception)
713+
return {}
714+
698715
def fetch_arrldx_country_band_count(self) -> dict:
699716
"""
700717
returns dict with count of unique NR.

0 commit comments

Comments
 (0)