Show last authors
1 {{velocity}}
2
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 "$xwlquery"
7 #set($list=$services.query.xwql($xwlquery).execute())
8
9 {{/velocity}}
10
11 {{python}}
12
13 import sys
14 print "Python version is ", sys.version
15 print
16
17 className = "Duncan1.Code.GDataClass"
18 template = "Duncan1.Code.GDataTemplate"
19 xwlquery = "from doc.object(\'" + className + "\') as obj where doc.fullName <> \'" + template + "\' order by doc.date desc"
20 print "\"%s\"" % xwlquery
21 # list = services.query.xwql(xwlquery).execute()
22
23 totalF=0
24 totalM=0
25 nPos=list.size()
26 for item in list:
27 itemdoc = xwiki.getDocument(item)
28 nFInPos = itemdoc.getValue('QuaWoman')
29 nMInPos = itemdoc.getValue('QuaMan')
30 totalF += nFInPos
31 totalM += nMInPos
32 totalFM = totalF+totalM
33 print "%s records processed\n%s pers. incl. woman: %s; man: %s" % (nPos, totalFM, totalF, totalM)
34
35 iDunc = 0.0
36 for item in list:
37 itemdoc = xwiki.getDocument(item)
38 nFInPos = itemdoc.getValue("QuaWoman")
39 nMInPos = itemdoc.getValue("QuaMan")
40 iDunc += abs(nFInPos/float(totalF) - nMInPos/float(totalM))
41 iDunc *= 0.5
42 print "Duncan index = %s" % (iDunc)
43 {{/python}}

Need help?

If you need help with XWiki you can contact: