Commit 9d8526d2 authored by Jérome Perrin's avatar Jérome Perrin

Result Comparison: display time unit and convert delay to days in some cases

parent 3b3e2221
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
} }
$(td).text("").css({"background-color": color}); $(td).text("").css({"background-color": color});
a = $("<a>").attr("href", value.link) a = $("<a>").attr("href", value.link)
.text(value.completionDate + "\n" + (value.delay || 0).toFixed(0)) .text(value.completionDate + "\n" + (value.delayText || (value.delay || 0).toFixed(0)))
.css({color: "black", "text-shadow": "none"}); .css({color: "black", "text-shadow": "none"});
a.appendTo(td); a.appendTo(td);
} }
......
...@@ -24,10 +24,14 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin) ...@@ -24,10 +24,14 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin)
order_lateness_dict[order['id']] = { order_lateness_dict[order['id']] = {
'dueDate': self.convertToFormattedRealWorldTime(dueDate), 'dueDate': self.convertToFormattedRealWorldTime(dueDate),
# XXX do we want to format to another time unit ? days ? # XXX do we want to format to another time unit ? days ?
'delay': (obj["results"]["completionTime"] - dueDate) if completed else None, # XXX manpy outputs delay, but it is sometimes wrong 'delayText': ("%d %s" % (obj["results"]["completionTime"] - dueDate, data['general']['timeUnit'])) if completed else None, # XXX manpy outputs delay, but it is sometimes wrong
'delay': obj["results"]["completionTime"] - dueDate if completed else None,
'manpy_delay': obj['results'].get('delay'), 'manpy_delay': obj['results'].get('delay'),
'completionDate': self.convertToFormattedRealWorldTime(obj["results"]["completionTime"]) if completed else obj["results"]["completionTime"], 'completionDate': self.convertToFormattedRealWorldTime(obj["results"]["completionTime"]) if completed else obj["results"]["completionTime"],
} }
# XXX format delay as number of days.
if data['general']['timeUnit'] == 'hour' and completed:
order_lateness_dict[order['id']]['delayText'] = "%d Days" % ((obj["results"]["completionTime"] - dueDate) / 24.)
else: else:
# if order is not processed at all, it has no schedule. # if order is not processed at all, it has no schedule.
order_lateness_dict[order['id']] = { order_lateness_dict[order['id']] = {
...@@ -43,6 +47,7 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin) ...@@ -43,6 +47,7 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin)
order_lateness_dict[obj["id"]] = { order_lateness_dict[obj["id"]] = {
"dueDate": self.convertToFormattedRealWorldTime(dueDate), "dueDate": self.convertToFormattedRealWorldTime(dueDate),
"delay": completionTime - dueDate, "delay": completionTime - dueDate,
"delayText": "%d %s" % (completionTime - dueDate, data['general']['timeUnit']),
"completionDate": self.convertToFormattedRealWorldTime(completionTime) "completionDate": self.convertToFormattedRealWorldTime(completionTime)
} }
else: else:
......
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