Álvaro Valenzuela Valdes commited on
Commit
7372799
·
1 Parent(s): 0acf400

fix: ensure API calls always include required date parameter and improve status feedback

Browse files
backend/app/services/mercado_publico.py CHANGED
@@ -172,7 +172,8 @@ async def _fetch(params: Dict[str, str], retries: int = 3) -> List[Tender]:
172
 
173
  async def get_active_tenders() -> List[Tender]:
174
  """Fetch tenders active today."""
175
- return await _fetch({})
 
176
 
177
  async def get_tenders_by_date(date_ddmmaaaa: str) -> List[Tender]:
178
  """Fetch tenders for a specific date (ddmmaaaa)."""
 
172
 
173
  async def get_active_tenders() -> List[Tender]:
174
  """Fetch tenders active today."""
175
+ today = datetime.now().strftime("%d%m%Y")
176
+ return await _fetch({"fecha": today})
177
 
178
  async def get_tenders_by_date(date_ddmmaaaa: str) -> List[Tender]:
179
  """Fetch tenders for a specific date (ddmmaaaa)."""
backend/app/services/mercado_publico_oc.py CHANGED
@@ -126,8 +126,8 @@ async def get_oc_by_code(code: str) -> Optional[PurchaseOrder]:
126
  async def get_ocs_by_date(date: str, status: str = "todos") -> List[PurchaseOrder]:
127
  params = {"estado": status}
128
  today_str = datetime.now().strftime("%d%m%Y")
129
- if date == today_str and status == "todos":
130
- return await _fetch_oc({"estado": "todos"})
131
 
132
  params["fecha"] = date
133
  return await _fetch_oc(params)
 
126
  async def get_ocs_by_date(date: str, status: str = "todos") -> List[PurchaseOrder]:
127
  params = {"estado": status}
128
  today_str = datetime.now().strftime("%d%m%Y")
129
+ if date is None or (date == today_str and status == "todos"):
130
+ return await _fetch_oc({"fecha": today_str})
131
 
132
  params["fecha"] = date
133
  return await _fetch_oc(params)
frontend/components/Sidebar.tsx CHANGED
@@ -110,7 +110,7 @@ export default function Sidebar({ tabs, activeTab, onTabSelect, status, lang, fo
110
  <div className="flex items-center gap-2">
111
  <div className={`w-2 h-2 rounded-full ${status === "connected" ? "bg-green-500 animate-pulse" : "bg-yellow-500"}`} />
112
  <span className={`text-xs font-medium ${status === "connected" ? "text-green-300" : "text-yellow-300"}`}>
113
- Systems Nominal
114
  </span>
115
  </div>
116
  </>
 
110
  <div className="flex items-center gap-2">
111
  <div className={`w-2 h-2 rounded-full ${status === "connected" ? "bg-green-500 animate-pulse" : "bg-yellow-500"}`} />
112
  <span className={`text-xs font-medium ${status === "connected" ? "text-green-300" : "text-yellow-300"}`}>
113
+ {status === "connected" ? "Systems Nominal" : "Connection Warning"}
114
  </span>
115
  </div>
116
  </>