fix: include finish milestones (TT_FinMile) in milestone queries

The list_milestones tool was only returning start milestones (TT_Mile)
and missing all finish milestones. P6 uses two task types for milestones:
- TT_Mile = Start Milestone
- TT_FinMile = Finish Milestone

Changes:
- Update query_milestones() to include both TT_Mile and TT_FinMile
- Derive milestone_type from task_type when not explicitly set:
  - TT_Mile -> 'start'
  - TT_FinMile -> 'finish'
- Add unit tests for milestone_type derivation from task_type

This fixes the E-J Electric schedule returning 5 milestones instead of 62.
This commit is contained in:
2026-01-08 11:55:43 -05:00
parent af8cdc1d31
commit bf2f85813e
3 changed files with 165 additions and 6 deletions

View File

@@ -26,6 +26,22 @@ class TaskHandler(TableHandler):
float_str = data.get("total_float_hr_cnt", "")
total_float = float(float_str) if float_str else None
# Parse milestone_type
# First check explicit milestone_type field (MS_Start -> 'start', MS_Finish -> 'finish')
# Then derive from task_type (TT_Mile -> 'start', TT_FinMile -> 'finish')
raw_milestone_type = data.get("milestone_type", "")
task_type = data.get("task_type", "")
milestone_type = None
if raw_milestone_type:
if raw_milestone_type == "MS_Start":
milestone_type = "start"
elif raw_milestone_type == "MS_Finish":
milestone_type = "finish"
elif task_type == "TT_Mile":
milestone_type = "start"
elif task_type == "TT_FinMile":
milestone_type = "finish"
return {
"task_id": data.get("task_id", ""),
"proj_id": data.get("proj_id", ""),
@@ -42,4 +58,5 @@ class TaskHandler(TableHandler):
"act_end_date": convert_date(data.get("act_end_date")),
"total_float_hr_cnt": total_float,
"driving_path_flag": driving_path,
"milestone_type": milestone_type,
}