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

Initial plugin to postprocess order lateness

parent 6f321946
from dream.plugins import plugin
from dream.plugins.TimeSupport import TimeSupportMixin
class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin):
""" Postprocess order lateness for Input_viewResultOrderLateness
"""
def postprocess(self, data):
self.initializeTimeSupport(data)
for result in data['result']['result_list']:
for obj in result['elementList']:
if obj.get('_class') == "Dream.OrderDesign": # XXX How to find orders ?
result.setdefault(self.configuration_dict["output_id"], {})[obj["id"]] = {
"dueDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"] - obj["results"].get("delay", 0)),
"delay": obj["results"].get("delay", 0),
"completionDate": self.convertToFormattedRealWorldTime(obj["results"]["completionTime"])
}
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