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
0ad1a662
Commit
0ad1a662
authored
Feb 18, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shift plugin to work when day changes
parent
25517689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
dream/plugins/ReadShiftFromSpreadsheet.py
dream/plugins/ReadShiftFromSpreadsheet.py
+12
-4
No files found.
dream/plugins/ReadShiftFromSpreadsheet.py
View file @
0ad1a662
...
...
@@ -27,12 +27,16 @@ class ReadShiftFromSpreadsheet(plugin.InputPreparationPlugin, TimeSupportMixin):
if
line
[
1
]:
start_time
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
2
]),
'%Y/%m/%d %H:%M'
))
stop_time
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
3
]),
'%Y/%m/%d %H:%M'
))
# if the end of shift
is before now we do not need this shif in the
simulation
if
stop_time
<=
0
:
# if the end of shift
shift already finished we do not need to consider in
simulation
if
st
art_time
<
0
and
st
op_time
<=
0
:
continue
# if the start of the shift is before now, set the start to 0
if
start_time
<
0
:
start_time
=
0
# sometimes the date may change (e.g. shift from 23:00 to 01:00).
# these would be declared in the date of the start so add a date (1440) to the end
if
stop_time
<
start_time
:
stop_time
+=
1440
for
station
in
line
[
1
].
split
(
','
):
station
=
station
.
strip
()
shift_by_station
.
setdefault
(
station
,
[]).
append
(
...
...
@@ -44,12 +48,16 @@ class ReadShiftFromSpreadsheet(plugin.InputPreparationPlugin, TimeSupportMixin):
if
line
[
1
]:
start_time
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
2
]),
'%Y/%m/%d %H:%M'
))
stop_time
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
3
]),
'%Y/%m/%d %H:%M'
))
# if the end of shift
is before now we do not need this shif in the
simulation
if
stop_time
<=
0
:
# if the end of shift
shift already finished we do not need to consider in
simulation
if
st
art_time
<
0
and
st
op_time
<=
0
:
continue
# if the start of the shift is before now, set the start to 0
if
start_time
<
0
:
start_time
=
0
# sometimes the date may change (e.g. shift from 23:00 to 01:00).
# these would be declared in the date of the start so add a date (1440) to the end
if
stop_time
<
start_time
:
stop_time
+=
1440
for
station
in
line
[
1
].
split
(
','
):
station
=
station
.
strip
()
shift_by_station
.
setdefault
(
station
,
[]).
append
(
...
...
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