Force commit before count

This commit is contained in:
localhost_frssoft 2022-11-01 19:05:18 +03:00
parent aca05b4ffa
commit d4da5358af
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,9 @@ c.execute(
conn.commit()
def force_commit():
conn.commit()
def mark_as_watched_movie(original_name=None, ru_name=None, year=None):
try:
@ -38,7 +41,6 @@ def get_already_watched(original_name=None, ru_name=None, year=None):
def get_count_all_watched_movies():
conn.commit() # May be fix wrong count
return len(c.execute('SELECT * FROM watched_movies').fetchall())

View File

@ -1,12 +1,13 @@
from src.fedi_api import get_status, post_status, upload_attachment
from src.fmn_states_db import add_state, get_state, clear_all_states
from src.fmn_database import get_movies_for_poll, write_votes, read_votes, mark_as_watched_movie, get_already_watched, rewrite_db, reset_poll, get_count_all_watched_movies
from src.fmn_database import get_movies_for_poll, write_votes, read_votes, mark_as_watched_movie, get_already_watched, rewrite_db, reset_poll, get_count_all_watched_movies, force_commit
from collections import Counter
from loguru import logger
import time
def text_create_poll():
force_commit()
count_poll = get_count_all_watched_movies()
text_poll = f'''Друзья, {count_poll} голосование за следующий Fediverse Movie Night объявляю открытым!