Update manager #23

Merged
Miroslavsckaya merged 20 commits from feature_rss_update into master 2022-07-08 19:23:12 +00:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit 82641cc655 - Show all commits

View File

@ -129,11 +129,11 @@ class Database:
def update_feed_items(self, feed_id: int, new_items: list[FeedItem]) -> None: def update_feed_items(self, feed_id: int, new_items: list[FeedItem]) -> None:
"""Replace last feed items with a list items that receive.""" """Replace last feed items with a list items that receive."""
for i in range(len(new_items)): for i in range(len(new_items)):
new_items[i] = [feed_id] + list(new_items[i].__dict__.values()) new_items[i] = [feed_id] + list(new_items[i].__dict__.values())[:-1]
self.cur.execute('DELETE FROM feeds_last_items WHERE feed_id = ?', [feed_id]) self.cur.execute('DELETE FROM feeds_last_items WHERE feed_id = ?', [feed_id])
self.cur.executemany( self.cur.executemany(
'INSERT INTO feeds_last_items (feed_id, url, title, description, date) VALUES (?, ?, ?, ?, ?)', new_items) 'INSERT INTO feeds_last_items (feed_id, url, title, description) VALUES (?, ?, ?, ?)', new_items)
self.conn.commit() self.conn.commit()
def __init_schema(self): def __init_schema(self):
@ -157,7 +157,6 @@ class Database:
' url TEXT NOT NULL UNIQUE,' ' url TEXT NOT NULL UNIQUE,'
' title TEXT,' ' title TEXT,'
' description TEXT,' ' description TEXT,'
' date NUMERIC,'
' FOREIGN KEY(feed_id) REFERENCES feeds(id)' ' FOREIGN KEY(feed_id) REFERENCES feeds(id)'
')' ')'
) )