Updated script to sort by end time

This commit is contained in:
Rahul Tenany 2020-11-17 16:12:05 -08:00
parent 9b05af85a9
commit b5826b2362

View File

@ -6,8 +6,8 @@ import xml.etree.ElementTree as ET
from structures import Job
from gantt_types import ThreadId
def get_nodeId(elem: Job) -> int:
return elem.nodeId
def get_jobEnd(elem: Job) -> datetime:
return elem.end
def read_jobs(filename: str) -> List[Job]:
jobs: List[Job] = []
@ -25,7 +25,7 @@ def read_jobs(filename: str) -> List[Job]:
jobs.append(job)
sortedJobs: List[Job] = []
sortedJobs = sorted(jobs, key=get_nodeId)
sortedJobs = sorted(jobs, key=get_jobEnd)
return sortedJobs