Fix news diff

This commit is contained in:
norohind 2021-11-27 01:12:43 +03:00
parent 9357a2ecfa
commit 427bb4222a
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 14 additions and 1 deletions

View File

@ -100,7 +100,7 @@ limit 2;"""
# limit 2;"""
select_new_old_news: str = """select {column}
from news
where squad_id = ? and category = 'Squadrons_History_Category_PublicStatement'
where squad_id = ? and type_of_news = 'public_statements'
order by inserted_timestamp desc
limit 2;"""

View File

@ -238,6 +238,19 @@ def _update_squad_news(squad_id: int, db_conn: sqlite3.Connection) -> Union[bool
for type_of_news_key in squad_news:
one_type_of_news: list = squad_news[type_of_news_key]
if len(squad_news[type_of_news_key]) == 0:
logger.info(f'squad_news[{type_of_news_key}] len == 0')
with db_conn:
db_conn.execute(
sql_requests.insert_news,
(
squad_id,
type_of_news_key,
*[None for i in range(0, 10)]
)
)
news: dict
for news in one_type_of_news:
with db_conn: