Skip to content

Commit d08fe7f

Browse files
mcherifclaude
andcommitted
Fix employment history: sort present roles first so current employer fills slot 0
_fill_employment_history iterated work_history in YAML order. work_history[0] was AMD (Feb 2022–Jan 2025), which was being written into the form's first employment slot — overwriting the 'Inner Loop' that fill_form had already placed via the current_company rule. Sort by present/ongoing first before iterating so the form always gets the active employer in position 0, regardless of how the user orders work_history in profile.yaml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 35e03f7 commit d08fe7f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

utils/form_prefill.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,13 @@ def _log(msg: str) -> None:
777777
if not work_history:
778778
return
779779

780+
# Present/ongoing roles must come first so the form's first employment slot
781+
# gets the current employer — YAML order may put a past role first.
782+
work_history = sorted(
783+
work_history,
784+
key=lambda e: (0 if str(e.get("to") or "").strip().lower() == "present" else 1),
785+
)
786+
780787
# Selectors for the "Add another" button in employment sections.
781788
add_btn_selectors = [
782789
"button:has-text('Add another')",

0 commit comments

Comments
 (0)