Hide last authors
Alexandru Colesnicov 1.3 1 {{velocity}}
Alexandru Colesnicov 6.2 2
Alexandru Colesnicov 1.3 3 #set($class="Duncan1.Code.GDataClass")
4 #set($template="Duncan1.Code.GDataTemplate")
5 #set($xwlquery="from doc.object($class) as obj where doc.fullName <> '$template' order by doc.date desc")
6 #set($list=$services.query.xwql($xwlquery).execute())
Alexandru Colesnicov 6.2 7
Alexandru Colesnicov 1.3 8 {{/velocity}}
Alexandru Colesnicov 6.2 9
Alexandru Colesnicov 5.1 10 {{python}}
Alexandru Colesnicov 6.2 11
Alexandru Colesnicov 13.1 12 import sys
Alexandru Colesnicov 15.3 13 print "Python version is ", sys.version
Alexandru Colesnicov 14.1 14 print
Alexandru Colesnicov 15.4 15
16 totalF=0
17 totalM=0
18 nPos=list.size()
19 for item in list:
20 itemdoc = xwiki.getDocument(item)
21 nFInPos = itemdoc.getValue('QuaWoman')
22 nMInPos = itemdoc.getValue('QuaMan')
23 totalF += nFInPos
24 totalM += nMInPos
25 totalFM = totalF+totalM
26 print "%s records processed\n%s pers. incl. woman: %s; man: %s" % (nPos, totalFM, totalF, totalM)
27
Alexandru Colesnicov 6.1 28 iDunc = 0.0
Alexandru Colesnicov 9.5 29 for item in list:
Alexandru Colesnicov 5.1 30 itemdoc = xwiki.getDocument(item)
Alexandru Colesnicov 9.4 31 nFInPos = itemdoc.getValue("QuaWoman")
32 nMInPos = itemdoc.getValue("QuaMan")
Alexandru Colesnicov 12.1 33 iDunc += abs(nFInPos/float(totalF) - nMInPos/float(totalM))
Alexandru Colesnicov 9.2 34 iDunc *= 0.5
Alexandru Colesnicov 10.1 35 print "Duncan index = %s" % (iDunc)
Alexandru Colesnicov 5.1 36 {{/python}}

Tips

Press the x+x+x+a key combo to toggle the Advanced mode and x+x+x+h to toggle the display of hidden pages.

Need help?

If you need help with XWiki you can contact: