forked from Zhubei_iXD/report_skill_expm
feat: sort time entries by ID in tree structure building
This commit is contained in:
parent
5a3824a85f
commit
fffef17056
|
|
@ -617,6 +617,9 @@ class WeekWorkPackageLogger:
|
|||
|
||||
def _build_tree_structure(self, time_entries: List[Dict]) -> Dict[str, TreeNode]:
|
||||
"""Build tree structure from time entries"""
|
||||
# Sort time entries by ID ascending (oldest first)
|
||||
time_entries_sorted = sorted(time_entries, key=lambda x: int(x.get('id', 0)))
|
||||
|
||||
# Create root nodes for projects
|
||||
project_trees = {}
|
||||
|
||||
|
|
@ -625,7 +628,7 @@ class WeekWorkPackageLogger:
|
|||
# which may not be the root project but a child project in the hierarchy
|
||||
project_entries = defaultdict(lambda: defaultdict(list))
|
||||
|
||||
for entry in time_entries:
|
||||
for entry in time_entries_sorted:
|
||||
try:
|
||||
# Extract basic information
|
||||
spent_on = entry.get('spentOn', 'Unknown')
|
||||
|
|
|
|||
Loading…
Reference in New Issue