05/24 Fix UI/UX

This commit is contained in:
2026-05-24 17:59:24 -04:00
parent 07e0ae02c2
commit 6605484927
8 changed files with 154 additions and 24 deletions
+16 -15
View File
@@ -1272,26 +1272,27 @@ def get_ai_analysis_detail(analysis_id: int):
BID_STATUSES = ("open", "monitoring", "awarded", "no_bid", "cancelled")
def get_all_bids(status_filter: str = "") -> list:
def get_all_bids(status_filter: str = "", limit: int = 50, offset: int = 0) -> list:
conn = None
try:
conn = get_connection()
cur = conn.cursor(dictionary=True)
where = "WHERE b.status=%s" if status_filter else ""
params = (status_filter,) if status_filter else ()
cur.execute(
f"""
SELECT b.*, u.username AS added_by_username,
COUNT(bu.id) AS update_count
FROM bid_tracker b
LEFT JOIN users u ON u.id=b.added_by
LEFT JOIN bid_updates bu ON bu.bid_id=b.id
{where}
GROUP BY b.id
ORDER BY b.due_date IS NULL, b.due_date ASC, b.created_at DESC
""",
params,
parts = [
"SELECT b.*, u.username AS added_by_username, COUNT(bu.id) AS update_count"
" FROM bid_tracker b"
" LEFT JOIN users u ON u.id=b.added_by"
" LEFT JOIN bid_updates bu ON bu.bid_id=b.id"
]
params = []
if status_filter:
parts.append("WHERE b.status=%s")
params.append(status_filter)
parts.append(
"GROUP BY b.id ORDER BY b.due_date IS NULL, b.due_date ASC, b.created_at DESC"
" LIMIT %s OFFSET %s"
)
params.extend([limit, offset])
cur.execute(" ".join(parts), params)
rows = cur.fetchall()
cur.close()
return rows