v1.1.53: filter scenario history by app_version (fix stale results after redeploy)
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ from routes.api_test import bp as api_test_bp
|
||||
from routes.api_scenario import bp as api_scenario_bp
|
||||
|
||||
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
||||
VERSION = "1.1.52"
|
||||
VERSION = "1.1.53"
|
||||
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
|
||||
|
||||
@@ -120,7 +120,7 @@ def api_scenario_run_status(run_id):
|
||||
cur = conn.cursor()
|
||||
cur.execute("""
|
||||
SELECT id, created_at, scenario_name, status, current_step, total_steps,
|
||||
duration_sec, error_log
|
||||
duration_sec, error_log, app_version
|
||||
FROM scenario_runs
|
||||
WHERE id = %s AND client_id = %s AND stand = %s
|
||||
""", (run_id, get_client_id(), get_stand()))
|
||||
@@ -148,7 +148,7 @@ def api_scenario_status():
|
||||
cur = conn.cursor()
|
||||
cur.execute("""
|
||||
SELECT id, created_at, scenario_name, status, current_step, total_steps,
|
||||
duration_sec, error_log
|
||||
duration_sec, error_log, app_version
|
||||
FROM scenario_runs
|
||||
WHERE client_id = %s AND stand = %s
|
||||
ORDER BY created_at DESC
|
||||
|
||||
+5
-3
@@ -497,9 +497,11 @@ async function loadScenarios(){
|
||||
}else{
|
||||
html+='<span style="color:var(--muted);font-size:11px;">Нет сценариев в БД</span>';
|
||||
}
|
||||
// Последний запуск
|
||||
if(srHistory && srHistory.length){
|
||||
const last=srHistory[0];
|
||||
// Последний запуск — только для текущей версии приложения
|
||||
const curVer=window.APP&&window.APP.version||'';
|
||||
const verHistory=srHistory&&srHistory.filter(r=>r.app_version===curVer);
|
||||
if(verHistory && verHistory.length){
|
||||
const last=verHistory[0];
|
||||
const icon=last.status==='OK'?'✅':last.status==='FAIL'?'❌':last.status==='RUNNING'?'⏳':'⏱';
|
||||
const time=last.created_at?last.created_at.replace('T',' ').substring(0,19):'?';
|
||||
html+=`<div style="font-size:11px;margin-top:4px;color:var(--muted);">Последний: ${icon} ${_esc(last.scenario_name)} — ${last.status} (шаг ${last.current_step}/${last.total_steps}) ${last.duration_sec!=null?last.duration_sec.toFixed(1)+'s':''} — ${time}</div>`;
|
||||
|
||||
Reference in New Issue
Block a user