#5 Changed styling and added product ranking in category to the stats page

This commit is contained in:
2024-02-11 15:52:12 +00:00
parent 9943a1492c
commit 83829af06f
5 changed files with 66 additions and 22 deletions

View File

@@ -42,18 +42,12 @@ def view_product_stats(id: int):
# Total Views
total_views = db.read_product_views(id)
# Ranking in category
ranking = db.read_ranking(id)
db = ProductController()
product = db.read_id(id)
# Ranking in category
query = """
SELECT id, count(id) FROM stats WHERE id = (
SELECT id FROM Products WEHRE id = (
SELECT categoryID FROM Products WHERE id = ?
)
)
"""
# Stock Level
product.quantityAvailable
@@ -62,7 +56,7 @@ def view_product_stats(id: int):
data = {
"age": time_since_posted,
"ranking": 0,
"ranking": ranking,
"views": {
"total": total_views,
"headings": list(reversed(product_view_frequency_data.keys())),