Commit e551ed32 authored by Jérome Perrin's avatar Jérome Perrin

PostProcessOrderLateness: also support capacity projects

parent 32e59c67
...@@ -7,14 +7,28 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin) ...@@ -7,14 +7,28 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin)
def postprocess(self, data): def postprocess(self, data):
self.initializeTimeSupport(data) self.initializeTimeSupport(data)
for result in data['result']['result_list']: for result in data['result']['result_list']:
order_lateness_dict = result[self.configuration_dict["output_id"]] = {}
for obj in result['elementList']: for obj in result['elementList']:
if obj.get('_class') == "Dream.OrderDesign": # XXX How to find orders ? if obj.get('_class') == "Dream.OrderDesign": # XXX How to find orders ?
result.setdefault(self.configuration_dict["output_id"], {})[obj["id"]] = { order_lateness_dict[obj["id"]] = {
"dueDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"] - obj["results"].get("delay", 0)), "dueDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"] - obj["results"].get("delay", 0)),
"delay": obj["results"].get("delay", 0), "delay": obj["results"].get("delay", 0),
"completionDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"]) "completionDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"])
} }
if obj.get('_class') == "Dream.CapacityProject": # XXX How to find orders ?
if obj["results"]["schedule"]:
completionTime = obj["results"]["schedule"][-1]["exitTime"]
order_lateness_dict[obj["id"]] = {
"dueDate": self.convertToFormattedRealWorldTime(obj["dueDate"]),
"delay": completionTime - obj["dueDate"],
"completionDate": self.convertToFormattedRealWorldTime(completionTime)
}
else:
order_lateness_dict[obj["id"]] = {
"dueDate": self.convertToFormattedRealWorldTime(obj["dueDate"]),
"delay": 1000,
"completionDate": "Unfinished"
}
return data return data
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment