fix news hook

This commit is contained in:
norohind 2021-11-21 04:37:10 +03:00
parent 727955d0ec
commit 9357a2ecfa
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 12 additions and 7 deletions

View File

@ -267,7 +267,7 @@ def new_old_news_diff(column: str, db_conn: sqlite3.Connection, squad_id: int) -
:param squad_id:
:return:
"""
sql_req: sqlite3.Cursor = db_conn.execute(sql_requests.select_old_new_news.format(column=column), (squad_id,))
sql_req: sqlite3.Cursor = db_conn.execute(sql_requests.select_new_old_news.format(column=column), (squad_id,))
try:
new = sql_req.fetchone()[0]

View File

@ -91,12 +91,17 @@ order by inserted_timestamp desc
limit 2;"""
# AAAAAAAAA, it require to do something with it
select_old_new_news: str = """select {column}
from squads_states inner join news on
squads_states.squad_id = news.squad_id
and substr(squads_states.inserted_timestamp, 1, 16) = substr(news.inserted_timestamp, 1, 16)
where category = 'Squadrons_History_Category_PublicStatement' and squads_states.squad_id = ?
order by squads_states.inserted_timestamp
# select_old_new_news: str = """select {column}
# from squads_states inner join news on
# squads_states.squad_id = news.squad_id
# and substr(squads_states.inserted_timestamp, 1, 16) = substr(news.inserted_timestamp, 1, 16)
# where category = 'Squadrons_History_Category_PublicStatement' and squads_states.squad_id = ?
# order by squads_states.inserted_timestamp
# limit 2;"""
select_new_old_news: str = """select {column}
from news
where squad_id = ? and category = 'Squadrons_History_Category_PublicStatement'
order by inserted_timestamp desc
limit 2;"""
select_important_before_delete: str = """select name, platform, member_count, tag, user_tags, created