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())
7 #set($totalF=0)
Alexandru Colesnicov 3.1 8 #set($totalM=0)
9 #set($nPos=$list.size())
Alexandru Colesnicov 1.3 10 #foreach($item in $list)
11 #set($itemdoc = $xwiki.getDocument($item))
Alexandru Colesnicov 2.1 12 ###$itemdoc.getName()
Alexandru Colesnicov 3.1 13 ###$itemdoc.get('Profession')
Alexandru Colesnicov 4.1 14 #set($nFInPos = $itemdoc.getValue('QuaWoman'))
15 #set($nMInPos = $itemdoc.getValue('QuaMan'))
16 #set($totalF = $totalF+$nFInPos)
17 #set($totalM = $totalM+$nMInPos)
Alexandru Colesnicov 1.3 18 #end
Alexandru Colesnicov 4.1 19 #set($totalFM=$totalF+$totalM)
Alexandru Colesnicov 3.1 20 $nPos records processed
Alexandru Colesnicov 4.1 21 $totalFM pers. incl. woman: $totalF; man: $totalM
Alexandru Colesnicov 6.2 22
Alexandru Colesnicov 1.3 23 {{/velocity}}
Alexandru Colesnicov 6.2 24
Alexandru Colesnicov 5.1 25 {{python}}
Alexandru Colesnicov 6.2 26
Alexandru Colesnicov 13.1 27 import sys
Alexandru Colesnicov 15.2 28 print "Python version is " sys.version
Alexandru Colesnicov 14.1 29 print
Alexandru Colesnicov 6.1 30 iDunc = 0.0
Alexandru Colesnicov 9.5 31 for item in list:
Alexandru Colesnicov 5.1 32 itemdoc = xwiki.getDocument(item)
Alexandru Colesnicov 9.4 33 nFInPos = itemdoc.getValue("QuaWoman")
34 nMInPos = itemdoc.getValue("QuaMan")
Alexandru Colesnicov 12.1 35 iDunc += abs(nFInPos/float(totalF) - nMInPos/float(totalM))
Alexandru Colesnicov 9.2 36 iDunc *= 0.5
Alexandru Colesnicov 10.1 37 print "Duncan index = %s" % (iDunc)
Alexandru Colesnicov 5.1 38 {{/python}}

Need help?

If you need help with XWiki you can contact: