[views/optimization] Prefetch state'names and comment format in wfhistory component
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 18 Nov 2016 17:44:52 +0100
changeset 11851 002007272a76
parent 11850 87443f279b0f
child 11852 dfcc3f74b3c8
[views/optimization] Prefetch state'names and comment format in wfhistory component This will avoid later queries to retrieve them.
cubicweb/web/views/workflow.py
--- a/cubicweb/web/views/workflow.py	Fri Nov 18 10:28:41 2016 +0100
+++ b/cubicweb/web/views/workflow.py	Fri Nov 18 17:44:52 2016 +0100
@@ -152,7 +152,8 @@
         else:
             sel += ',WF'
             headers = (_('from_state'), _('to_state'), _('comment'), _('date'))
-        rql = '%s %s, X eid %%(x)s' % (sel, rql)
+        sel += ',FSN,TSN,CF'
+        rql = '%s %s, FS name FSN, TS name TSN, WF comment_format CF, X eid %%(x)s' % (sel, rql)
         try:
             rset = self._cw.execute(rql, {'x': eid})
         except Unauthorized: