renad-108 commited on
Commit
b357a87
·
verified ·
1 Parent(s): 5d2ecbf

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +23 -22
src/streamlit_app.py CHANGED
@@ -423,28 +423,29 @@ def fetch_employees(employee_ids: Iterable[int]) -> pd.DataFrame:
423
 
424
 
425
  # --- Certifications ---
426
- cert_url = f"{base_url}certifications/{emp_id}"
427
- cert_resp = requests.get(cert_url, headers=headers)
428
- certs = []
429
- if cert_resp.status_code == 200:
430
- cert_data = cert_resp.json()
431
- if isinstance(cert_data, list):
432
- # Already a simple list of cert objects
433
- for c in cert_data:
434
- qual = c.get("qualifier")
435
- if qual:
436
- certs.append(qual)
437
- elif isinstance(cert_data, dict) and "assignments" in cert_data:
438
- # Parse UKG's assignments format
439
- for a in cert_data.get("assignments", []):
440
- cert_obj = a.get("certification", {})
441
- qual = cert_obj.get("qualifier")
442
- if qual:
443
- certs.append(qual)
444
- else:
445
- st.warning(f"Unrecognized cert format for {emp_id}: {cert_data}")
446
- else:
447
- st.warning(f"⚠️ Could not fetch certifications for {emp_id}")
 
448
 
449
 
450
  return {
 
423
 
424
 
425
  # --- Certifications ---
426
+
427
+ cert_url = f"{base_url}certifications/{emp_id}"
428
+ cert_resp = requests.get(cert_url, headers=headers)
429
+ certs = []
430
+ if cert_resp.status_code == 200:
431
+ cert_data = cert_resp.json()
432
+ if isinstance(cert_data, list):
433
+ # Already a simple list of cert objects
434
+ for c in cert_data:
435
+ qual = c.get("qualifier")
436
+ if qual:
437
+ certs.append(qual)
438
+ elif isinstance(cert_data, dict) and "assignments" in cert_data:
439
+ # Parse UKG's assignments format
440
+ for a in cert_data.get("assignments", []):
441
+ cert_obj = a.get("certification", {})
442
+ qual = cert_obj.get("qualifier")
443
+ if qual:
444
+ certs.append(qual)
445
+ else:
446
+ st.warning(f"Unrecognized cert format for {emp_id}: {cert_data}")
447
+ else:
448
+ st.warning(f"⚠️ Could not fetch certifications for {emp_id}")
449
 
450
 
451
  return {