fix start action: only for work; repair IFTA qualification work items: done -> running
This commit is contained in:
parent
82645fb574
commit
4c449d5dc4
2 changed files with 31 additions and 0 deletions
|
@ -28,6 +28,7 @@ from zope.app.pagetemplate import ViewPageTemplateFile
|
|||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.event import notify
|
||||
from zope.lifecycleevent import ObjectModifiedEvent
|
||||
from zope.security.proxy import removeSecurityProxy
|
||||
from zope.traversing.browser import absoluteURL
|
||||
from zope.traversing.api import getName, getParent
|
||||
|
||||
|
@ -733,3 +734,25 @@ def formatTimeDelta(value):
|
|||
return str(int(round(h / 24.0)))
|
||||
return u'%02i:%02i' % (h, m)
|
||||
|
||||
|
||||
class FixCheckupWorkItems(object):
|
||||
|
||||
def __call__(self):
|
||||
context = removeSecurityProxy(self.context)
|
||||
rm = context['records']['work']
|
||||
count = 0
|
||||
workItems = list(rm.values())
|
||||
for wi in workItems:
|
||||
if wi.state in ('done',):
|
||||
if wi.workItemType != 'checkup':
|
||||
print '*** done, but not checkup', wi.__name__
|
||||
continue
|
||||
wi.state = 'running'
|
||||
wi.reindex('state')
|
||||
if wi.end == wi.start:
|
||||
del wi.data['end']
|
||||
count += 1
|
||||
msg = '*** checked: %i, updated: %i.' % (len(workItems), count)
|
||||
print msg
|
||||
return msg
|
||||
|
||||
|
|
|
@ -132,6 +132,14 @@
|
|||
attribute="embed"
|
||||
permission="zope.View" />
|
||||
|
||||
<!-- repair -->
|
||||
|
||||
<browser:page
|
||||
name="fix_checkup_workitems.fix"
|
||||
for="loops.interfaces.ILoops"
|
||||
class="loops.organize.work.browser.FixCheckupWorkItems"
|
||||
permission="zope.View" />
|
||||
|
||||
<!-- setup -->
|
||||
|
||||
<zope:adapter factory="loops.organize.work.setup.SetupManager"
|
||||
|
|
Loading…
Add table
Reference in a new issue