[views] Warm answers in question primary view
authorVincent Michel <vincent.michel@logilab.fr>
Wed, 17 Jul 2013 10:44:56 +0200
changeset 308 0d353676690c
parent 307 d4526f95d55e
child 309 4312d239670e
[views] Warm answers in question primary view
views/primary.py
--- a/views/primary.py	Wed Jul 17 09:38:27 2013 +0200
+++ b/views/primary.py	Wed Jul 17 10:44:56 2013 +0200
@@ -538,8 +538,9 @@
     def display_main_col(self, entity):
         # Answers
         w = self.w
-        rset = self._cw.execute('Any A, AV, AD, AQ, I WHERE A is Answer, A question Q, Q eid %(e)s, '
-                                'A value AV, A datetime AD, '
+        rset = self._cw.execute('Any A, AQ, S, Q, AV, AD, AI, I, QT, QPA WHERE A is Answer, '
+                                'A question Q, Q eid %(e)s, Q type QT, Q possible_answers QPA, '
+                                'A value AV, A datetime AD, AQ identifier AI, '
                                 'A questionnaire_run AQ, AQ concerns S, S identifier I',
                                 {'e': entity.eid})
         w(u'<table class="table table-striped table-bordered table-condensed">')
@@ -549,7 +550,9 @@
         w(u'</tr>')
         for ind, answer in enumerate(rset.entities()):
             # XXX WARM CACHE ?
-            questionnaire_run = rset.get_entity(ind, 3)
+            qrun = rset.get_entity(ind, 1)
+            subject = rset.get_entity(ind, 2)
+            question = rset.get_entity(ind, 3)
             w(u'<tr>')
             w(u'<th><a href="%s">%s</a></th>' % (answer.absolute_url(), answer.dc_title()))
             w(u'<th>%s</th>' % answer.computed_value)