File tree Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Original file line number Diff line number Diff line change @@ -47,26 +47,14 @@ def index():
4747def urls ():
4848 conn = get_db_connection ()
4949 cur = conn .cursor ()
50- # Получение всех URL и последней проверки для каждого URL
5150 cur .execute ('SELECT * FROM urls ORDER BY created_at DESC' )
52- cur .execute ('''
53- SELECT u.id, u.name, u.created_at,
54- uc.status_code, uc.created_at AS last_check
55- FROM urls u
56- LEFT JOIN url_checks uc ON u.id = uc.url_id
57- WHERE uc.created_at = (
58- SELECT MAX(created_at)
59- FROM url_checks
60- WHERE url_id = u.id
61- )
62- ORDER BY u.created_at DESC
63- ''' )
6451 urls = cur .fetchall ()
65-
52+ cur .execute ('SELECT created_at FROM url_checks ORDER BY created_at DESC' )
53+ checks = cur .fetchall ()
6654 cur .close ()
6755 conn .close ()
6856
69- return render_template ('urls.html' , urls = urls )
57+ return render_template ('urls.html' , urls = urls , checks = checks )
7058
7159
7260@app .route ('/urls/<int:url_id>' , methods = ['GET' ])
You can’t perform that action at this time.
0 commit comments