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
720c4dc7
Commit
720c4dc7
authored
Mar 03, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buffers not displayed in component Gantt. task_id also displayed
parent
5f5ac6a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
20 deletions
+36
-20
dream/plugins/JSComponentGantt.py
dream/plugins/JSComponentGantt.py
+36
-20
No files found.
dream/plugins/JSComponentGantt.py
View file @
720c4dc7
...
@@ -7,12 +7,15 @@ from dream.plugins.TimeSupport import TimeSupportMixin
...
@@ -7,12 +7,15 @@ from dream.plugins.TimeSupport import TimeSupportMixin
import
datetime
import
datetime
class
JSComponentGantt
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
class
JSComponentGantt
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
# XXX hardoced classes of different components to be displayed in the gantt
'''class that gets the results and prepares the data for the component gantt graph'''
# XXX hard-coded classes of different components to be displayed in the gantt
COMPONENT_CLASS_SET
=
set
([
"Dream.OrderComponent"
,
"Dream.OrderDesign"
,
"Dream.Mould"
])
COMPONENT_CLASS_SET
=
set
([
"Dream.OrderComponent"
,
"Dream.OrderDesign"
,
"Dream.Mould"
])
# XXX hard-coded classes of stations to be displayed in the gantt
STATION_CLASS_SET
=
set
([
"Dream.MachineJobShop"
,
"Dream.MouldAssembly"
])
def
postprocess
(
self
,
data
):
def
postprocess
(
self
,
data
):
"""Post process the data for Gantt gadget
"""Post process the data for Gantt gadget
"""
"""
print
"trying to prepare gantt data for components"
strptime
=
datetime
.
datetime
.
strptime
strptime
=
datetime
.
datetime
.
strptime
# read the current date and define dateFormat from it
# read the current date and define dateFormat from it
try
:
try
:
...
@@ -29,7 +32,6 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -29,7 +32,6 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
# loop in the results to find Operators
# loop in the results to find Operators
for
element
in
resultElements
:
for
element
in
resultElements
:
if
element
[
'_class'
]
in
self
.
COMPONENT_CLASS_SET
:
if
element
[
'_class'
]
in
self
.
COMPONENT_CLASS_SET
:
print
element
[
"id"
]
componentId
=
element
[
'id'
]
componentId
=
element
[
'id'
]
# add the component in the task_dict
# add the component in the task_dict
task_dict
[
element
[
'id'
]]
=
dict
(
task_dict
[
element
[
'id'
]]
=
dict
(
...
@@ -43,24 +45,38 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
...
@@ -43,24 +45,38 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
if
schedule
:
if
schedule
:
for
record
in
schedule
:
for
record
in
schedule
:
stationId
=
record
[
'stationId'
]
stationClass
=
data
[
"graph"
][
"node"
][
stationId
][
"_class"
]
entranceTime
=
record
[
'entranceTime'
]
entranceTime
=
record
[
'entranceTime'
]
try
:
taskId
=
record
.
get
(
"task_id"
,
None
)
exitTime
=
schedule
[
k
][
'entranceTime'
]
# text to be displayed (if there is no task id display just the stationId)
except
IndexError
:
if
not
taskId
:
exitTime
=
maxSimTime
task_to_display
=
record
[
'stationId'
]
k
+=
1
else
:
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
task_to_display
=
record
[
'stationId'
]
+
"; "
+
taskId
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
# get the exitTime from the record
parent
=
componentId
,
exitTime
=
record
.
get
(
"exitTime"
,
None
)
text
=
record
[
'stationId'
],
if
exitTime
==
None
:
start_date
=
self
.
convertToRealWorldTime
(
# if there is no exitTime get it from the entranceTime of the next step
entranceTime
).
strftime
(
date_format
),
try
:
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
=
schedule
[
k
][
'entranceTime'
]
exitTime
).
strftime
(
date_format
),
# if there is no next step
open
=
False
,
except
IndexError
:
entranceTime
=
entranceTime
,
exitTime
=
maxSimTime
duration
=
exitTime
-
entranceTime
,
k
+=
1
)
if
stationClass
in
self
.
STATION_CLASS_SET
:
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
parent
=
componentId
,
text
=
task_to_display
,
#record['stationId']+"; "+taskId,
start_date
=
self
.
convertToRealWorldTime
(
entranceTime
).
strftime
(
date_format
),
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
).
strftime
(
date_format
),
open
=
False
,
entranceTime
=
entranceTime
,
duration
=
exitTime
-
entranceTime
,
)
# return the result to the gadget
# return the result to the gadget
result
=
data
[
'result'
][
'result_list'
][
-
1
]
result
=
data
[
'result'
][
'result_list'
][
-
1
]
...
...
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