v1.1.53: filter scenario history by app_version (fix stale results after redeploy)

This commit is contained in:
2026-07-30 16:10:53 +04:00
parent 7354d9c125
commit e5e96593f1
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ from routes.api_test import bp as api_test_bp
from routes.api_scenario import bp as api_scenario_bp from routes.api_scenario import bp as api_scenario_bp
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
VERSION = "1.1.52" VERSION = "1.1.53"
app = Flask(__name__, template_folder="templates", static_folder="static") 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") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
+2 -2
View File
@@ -120,7 +120,7 @@ def api_scenario_run_status(run_id):
cur = conn.cursor() cur = conn.cursor()
cur.execute(""" cur.execute("""
SELECT id, created_at, scenario_name, status, current_step, total_steps, SELECT id, created_at, scenario_name, status, current_step, total_steps,
duration_sec, error_log duration_sec, error_log, app_version
FROM scenario_runs FROM scenario_runs
WHERE id = %s AND client_id = %s AND stand = %s WHERE id = %s AND client_id = %s AND stand = %s
""", (run_id, get_client_id(), get_stand())) """, (run_id, get_client_id(), get_stand()))
@@ -148,7 +148,7 @@ def api_scenario_status():
cur = conn.cursor() cur = conn.cursor()
cur.execute(""" cur.execute("""
SELECT id, created_at, scenario_name, status, current_step, total_steps, SELECT id, created_at, scenario_name, status, current_step, total_steps,
duration_sec, error_log duration_sec, error_log, app_version
FROM scenario_runs FROM scenario_runs
WHERE client_id = %s AND stand = %s WHERE client_id = %s AND stand = %s
ORDER BY created_at DESC ORDER BY created_at DESC
+5 -3
View File
@@ -497,9 +497,11 @@ async function loadScenarios(){
}else{ }else{
html+='<span style="color:var(--muted);font-size:11px;">Нет сценариев в БД</span>'; html+='<span style="color:var(--muted);font-size:11px;">Нет сценариев в БД</span>';
} }
// Последний запуск // Последний запуск — только для текущей версии приложения
if(srHistory && srHistory.length){ const curVer=window.APP&&window.APP.version||'';
const last=srHistory[0]; 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 icon=last.status==='OK'?'✅':last.status==='FAIL'?'❌':last.status==='RUNNING'?'⏳':'⏱';
const time=last.created_at?last.created_at.replace('T',' ').substring(0,19):'?'; 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>`; 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>`;