diff --git a/.streamlit/config.toml b/.streamlit/config.toml index 8076643..ce8125d 100644 --- a/.streamlit/config.toml +++ b/.streamlit/config.toml @@ -1,2 +1,5 @@ [server] port = 15001 +headless = true +enableCORS = false +enableXsrfProtection = false diff --git a/dashboard.py b/dashboard.py index 4f7fc05..378b77f 100644 --- a/dashboard.py +++ b/dashboard.py @@ -87,10 +87,11 @@ def _load_detail(campaign_id: str, date_from: str, date_to: str): st.sidebar.title("Filtros") today = date.today() yesterday = today - timedelta(days=1) +default_from = yesterday - timedelta(days=6) # ΓΊltimos 7 dΓ­as por defecto first_of_month = today.replace(day=1) c1, c2 = st.sidebar.columns(2) -date_from = c1.date_input("Desde", value=first_of_month, max_value=yesterday) +date_from = c1.date_input("Desde", value=default_from, max_value=yesterday) date_to = c2.date_input("Hasta", value=yesterday, min_value=date_from, max_value=yesterday) if st.sidebar.button("πŸ”„ Actualizar", use_container_width=True): @@ -105,7 +106,11 @@ if date_from > date_to: # ── Data ────────────────────────────────────────────────────────────────────── -daily_rows, campaign_metrics, vertical_cpls = _load_data(date_from_str, date_to_str) +try: + daily_rows, campaign_metrics, vertical_cpls = _load_data(date_from_str, date_to_str) +except Exception as _e: + st.error(f"Error cargando datos de Meta API: {_e}") + st.stop() # Aggregate daily totals with per-vertical margins _daily: dict = {}