Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
af17c221
Commit
af17c221
authored
Sep 16, 2015
by
Jérome Perrin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PostProcessOrderLateness: update delay calculation according to Dipo's suggestions
parent
b018c190
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
dream/plugins/PostProcessOrderLateness.py
dream/plugins/PostProcessOrderLateness.py
+16
-1
No files found.
dream/plugins/PostProcessOrderLateness.py
View file @
af17c221
import
math
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
...
...
@@ -31,7 +32,21 @@ class PostProcessOrderLateness(plugin.OutputPreparationPlugin, TimeSupportMixin)
}
# 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.
)
# XXX We round the number of days in the delay using the following approach:
# If the order cannot be finished before 16:30 (which is assumed to be the end of shift), we consider this is an extra day of delay.
# This is not generic, but looks good in the demo
calculatedDelayinHours
=
(
obj
[
"results"
][
"completionTime"
]
-
dueDate
)
calculatedDelayinDays
=
(
calculatedDelayinHours
//
24
)
+
math
.
floor
((
calculatedDelayinHours
%
24.0
/
24
)
/
(
16.5
/
24
)
)
order_lateness_dict
[
order
[
'id'
]][
'delayText'
]
=
"%d Days"
%
calculatedDelayinDays
self
.
logger
.
info
(
"calculatedDelayinHours %f, calculatedDelayinDays %f"
%
(
calculatedDelayinHours
,
calculatedDelayinDays
))
if
calculatedDelayinHours
<
0
:
color
=
"green"
elif
0
<=
calculatedDelayinHours
<=
16.5
:
color
=
"yellow"
else
:
color
=
"red"
order_lateness_dict
[
order
[
'id'
]][
'color'
]
=
color
else
:
# if order is not processed at all, it has no schedule.
order_lateness_dict
[
order
[
'id'
]]
=
{
...
...
Jérome Perrin
@jerome
mentioned in commit
35e5195b
·
Oct 14, 2016
mentioned in commit
35e5195b
mentioned in commit 35e5195b879d2e8e3d4e20d706f200aa5f1f22b6
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment