fix running work items: stop only if of type 'work'

This commit is contained in:
Helmut Merz 2015-03-21 17:10:10 +01:00
parent 0aeb854014
commit 3d3013b76c

View file

@ -295,12 +295,16 @@ class WorkItem(Stateful, Track):
def doStart(self, userName, **kw): def doStart(self, userName, **kw):
action = 'start' action = 'start'
# stop any running work item of user: # stop any running work item of user:
if self.state != 'running': # TODO: check: party query OK?
if (userName == self.userName and
self.workItemType == 'work' and
self.state != 'running'):
running = getParent(self).query( running = getParent(self).query(
party=userName, state='running') party=userName, state='running')
for wi in running: for wi in running:
wi.doAction('work', userName, if wi.workItemType == 'work':
end=(kw.get('start') or getTimeStamp())) wi.doAction('work', userName,
end=(kw.get('start') or getTimeStamp()))
# standard creation of new work item: # standard creation of new work item:
if not kw.get('start'): if not kw.get('start'):
kw['start'] = getTimeStamp() kw['start'] = getTimeStamp()