Wiki source code of Duncan Result
Version 6.2 by Alexandru Colesnicov on 2018/11/04 21:28
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
1.3 | 1 | {{velocity}} |
![]() |
6.2 | 2 | |
![]() |
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) | ||
![]() |
3.1 | 8 | #set($totalM=0) |
| 9 | #set($nPos=$list.size()) | ||
![]() |
1.3 | 10 | #foreach($item in $list) |
| 11 | #set($itemdoc = $xwiki.getDocument($item)) | ||
![]() |
2.1 | 12 | ###$itemdoc.getName() |
![]() |
3.1 | 13 | ###$itemdoc.get('Profession') |
![]() |
4.1 | 14 | #set($nFInPos = $itemdoc.getValue('QuaWoman')) |
| 15 | #set($nMInPos = $itemdoc.getValue('QuaMan')) | ||
| 16 | #set($totalF = $totalF+$nFInPos) | ||
| 17 | #set($totalM = $totalM+$nMInPos) | ||
![]() |
1.3 | 18 | #end |
![]() |
4.1 | 19 | #set($totalFM=$totalF+$totalM) |
![]() |
3.1 | 20 | $nPos records processed |
![]() |
4.1 | 21 | $totalFM pers. incl. woman: $totalF; man: $totalM |
![]() |
6.2 | 22 | |
![]() |
1.3 | 23 | {{/velocity}} |
![]() |
6.2 | 24 | |
![]() |
5.1 | 25 | {{python}} |
![]() |
6.2 | 26 | |
![]() |
6.1 | 27 | iDunc = 0.0 |
| 28 | for item in list | ||
![]() |
5.1 | 29 | itemdoc = xwiki.getDocument(item) |
| 30 | nFInPos = itemdoc.getValue('QuaWoman')) | ||
| 31 | nMInPos = itemdoc.getValue('QuaMan')) | ||
| 32 | iDunc += abs(nFInPos/totalF - nMInPos/totalM) | ||
![]() |
6.1 | 33 | iDunc *= 0.5*iDunc |
| 34 | print("Duncan index = ",iDunc) | ||
![]() |
6.2 | 35 | |
![]() |
5.1 | 36 | {{/python}} |
