PATCH: Fixed database not returning data in recommendations

UPDATE: Decreased polling time to 1 second for later use
This commit is contained in:
white
2025-01-30 10:24:26 +00:00
parent 6586506c97
commit f981b69c94
9 changed files with 77 additions and 55 deletions

View File

@@ -4,8 +4,8 @@ def categories():
"""
Returns all possible streaming categories
"""
with Database() as db:
all_categories = db.fetchall("SELECT * FROM categories")
db = Database()
all_categories = db.fetchall("SELECT * FROM categories")
return all_categories
@@ -13,8 +13,8 @@ def tags():
"""
Returns all possible streaming tags
"""
with Database() as db:
all_tags = db.fetchall("SELECT * FROM tags")
db = Database()
all_tags = db.fetchall("SELECT * FROM tags")
return all_tags
@@ -22,8 +22,8 @@ def most_popular_category():
"""
Returns the most popular category based on live stream viewers
"""
with Database() as db:
category = db.fetchone("""
db = Database()
category = db.fetchone("""
SELECT categories.category_id, categories.category_name
FROM streams
JOIN categories ON streams.category_id = categories.category_id