Rev 12555 | Blame | Compare with Previous | Last modification | View Log | RSS feed
!default uu=$wims_read_parm
!!one line by sheet : points quality best level
percents=!getscorepercent user=$uu
!if $showsheet=$empty
shlist=$activesh
exlist=$activexams
!else
shlist=$showsheet
shlist=!listintersect $activesh and $shlist
exlist=!items2lines $showsheet
exlist=!replace internal E by E, in $exlist
exlist=!select $exlist where column 1=E
exlist=$(exlist[;2])
exlist=!listintersect $activexams and $exlist
!endif
!distribute items 0,0 into per,av
!! w_$i etc are defined in sheetweights
!! give an average for all active sheets (or in showsheet) and for the user $uu
!! - even not seen in sequences ??
!for i in $shlist
!if $(f_$i)=$empty or $(w_$i)=$empty
!read adm/class/sheetweights
!endif
perc=!line $i of $percents
!distribute words $perc into p1,p2,p3,p4
!if $p2!=$empty and $(w_$i)!=$empty
!distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_
!set ff_$i=!mathsubst Q=$y_ in $(f_$i)
!for sev=0 to 2
!set ff_$i=!mathsubst I$sev=$(x$(sev)_) in $(ff_$i)
!next
per=$[$per+($(w_$i))*$(ff_$i)]
!endif
!next i
!if $showsheet!=$empty
totweight=0
!for i in $shlist
!set totweight=$[$totweight+$(w_$i)]
!next i
!endif
examout=!examscore user=$uu
!for i in $exlist
es_$i=!line 1 of $examout
es__$i=!word $i of $(es_$i)
!!it happens that es__$i is empty, so we calculate per with 0 instead
es_$i=$(es__$i)
!default es_$i=0
per=$[$per+$(ew_$i)*$(es_$i)/10]
es_$i=$(es__$i)
!if $showsheet!=$empty
!set totweight=$[$totweight+$(ew_$i)]
!endif
!next i
!if $totweight>0
per=$[rint($scoremax*100*$per/$totweight)/100]
!else
per=0
!endif