banao-tech commited on
Commit
37fd392
·
verified ·
1 Parent(s): 716ecfd

Update sheets.py

Browse files
Files changed (1) hide show
  1. sheets.py +10 -1
sheets.py CHANGED
@@ -157,9 +157,18 @@ def get_candidate_by_slack_id(slack_user_id: str) -> Optional[dict]:
157
  return None
158
 
159
 
 
 
 
 
 
 
 
 
 
160
  def get_active_candidates() -> list[dict]:
161
  records = _get_records(SHEET_CANDIDATES, CANDIDATES_HEADERS)
162
- return [r for r in records if r["status"] not in ("eliminated", "cleared")]
163
 
164
 
165
  def create_candidate(
 
157
  return None
158
 
159
 
160
+ def get_candidate_by_id(candidate_id: str) -> Optional[dict]:
161
+ """Return candidate dict by candidate_id or None if not found."""
162
+ records = _get_records(SHEET_CANDIDATES, CANDIDATES_HEADERS)
163
+ for row in records:
164
+ if str(row.get("candidate_id", "")).strip() == candidate_id.strip():
165
+ return row
166
+ return None
167
+
168
+
169
  def get_active_candidates() -> list[dict]:
170
  records = _get_records(SHEET_CANDIDATES, CANDIDATES_HEADERS)
171
+ return [r for r in records if str(r.get("status", "")) not in ("eliminated", "cleared")]
172
 
173
 
174
  def create_candidate(