From 93fb0d8a39a5975001f96463c626c85272eff8b6 Mon Sep 17 00:00:00 2001 From: Frederico Castro Date: Sat, 13 Dec 2025 16:50:11 -0300 Subject: [PATCH] Remove referencias ao Componente B dos scripts de inicializacao --- backend/scripts/bootstrap_ranking.sh | 40 +++++++--------------------- start-ngrok.sh | 2 +- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/backend/scripts/bootstrap_ranking.sh b/backend/scripts/bootstrap_ranking.sh index b90bf79..b31ac9c 100755 --- a/backend/scripts/bootstrap_ranking.sh +++ b/backend/scripts/bootstrap_ranking.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -# Escolhe binário do Python (funciona no host ou dentro do container) if [ -x "./venv/bin/python" ]; then VENV_PY="./venv/bin/python" elif command -v python3 >/dev/null 2>&1; then @@ -10,7 +9,6 @@ else VENV_PY="python" fi -# Configs DSN_CANDIDATES=() if [ -n "${ORACLE_LOCAL_DSN:-}" ]; then DSN_CANDIDATES+=("${ORACLE_LOCAL_DSN}") @@ -18,7 +16,7 @@ fi DSN_CANDIDATES+=("127.0.0.1:1521/XEPDB1" "oracle18c:1521/XEPDB1" "mqapilc_oracle18c:1521/XEPDB1") API_URL=${API_URL:-"http://localhost:8000"} -echo "[1/5] Aguardando Oracle..." +echo "[1/4] Aguardando Oracle..." DSN_HOST="" for candidate in "${DSN_CANDIDATES[@]}"; do echo " Testando ${candidate}..." @@ -36,13 +34,13 @@ PY done if [ -z "$DSN_HOST" ]; then - echo "ERRO: não foi possível conectar ao Oracle em nenhum dos DSN candidatos." + echo "ERRO: nao foi possivel conectar ao Oracle em nenhum dos DSN candidatos." exit 1 fi echo "Oracle OK em ${DSN_HOST}." -echo "[2/5] Conferindo contagem atual..." +echo "[2/4] Conferindo contagem atual..." COUNT=$($VENV_PY - </dev/null - # Espera concluir while true; do STATUS=$(curl -s "${API_URL}/api/v1/ranking/status") running=$($VENV_PY - <<'PY' @@ -79,30 +68,19 @@ STATUS="$STATUS") fi sleep 20 done - NEED_B="yes" -elif [ "${MAX_B}" -eq 0 ]; then - echo "[3/5] Tabela já tem dados, mas componente B nunca foi preenchido (max=0)." - NEED_B="yes" else - echo "[3/5] Tabela já possui dados e componente B preenchido (max=${MAX_B}). Pulando cálculo pesado." - NEED_B="no" + echo "[3/4] Tabela ja possui dados. Pulando processamento." fi -if [ "${NEED_B}" = "yes" ]; then - echo "[4/5] Rodando Componente B (PPG)..." - ORACLE_LOCAL_DSN=${DSN_HOST} PYTHONUNBUFFERED=1 $VENV_PY scripts/popular_componente_b.py -else - echo "[4/5] Componente B já presente, sem necessidade de recálculo." -fi - -echo "[5/5] Contagens finais:" +echo "[4/4] Contagens finais:" $VENV_PY - <0"); print("B>0",cur.fetchone()[0]) -cur.execute("select max(componente_b) from tb_ranking_consultor"); print("max B",cur.fetchone()[0]) +cur.execute("select count(*) from tb_ranking_consultor where componente_a>0"); print("Bloco A>0",cur.fetchone()[0]) +cur.execute("select count(*) from tb_ranking_consultor where componente_c>0"); print("Bloco C>0",cur.fetchone()[0]) +cur.execute("select count(*) from tb_ranking_consultor where componente_d>0"); print("Bloco D>0",cur.fetchone()[0]) cur.execute("select max(pontuacao_total) from tb_ranking_consultor"); print("max total",cur.fetchone()[0]) cur.close();conn.close() PY diff --git a/start-ngrok.sh b/start-ngrok.sh index 6c2e2d6..6b13645 100755 --- a/start-ngrok.sh +++ b/start-ngrok.sh @@ -33,7 +33,7 @@ if ! docker ps | grep -q ranking_frontend; then exit 1 fi -echo "[4b/5] Rodando bootstrap (ranking + componente B) dentro do backend..." +echo "[4b/5] Rodando bootstrap do ranking dentro do backend..." docker exec ranking_backend bash -lc "ORACLE_LOCAL_DSN=oracle18c:1521/XEPDB1 /app/scripts/bootstrap_ranking.sh" echo "[5/5] Iniciando ngrok..."