Rev 16807 | Blame | Compare with Previous | Last modification | View Log | RSS feed
!read adm/class/userisinclass ,$getuser
!if yes notin $script_reply
error=bad_usercls
!reset job,getuser
!exit
!endif
!if $getuser!=$empty
!! freeworks
!!
!! freworks are only listed in student score page if student has done
!! some work on the freework (for some types, just opened the freework)
test=!defof allowed_optional_module in wimshome/log/wims.conf
!if class/freework isitemof $test
allowed_freework=yes
!else
!reset allowed_freework,freeworkcnt
!endif
!if $allowed_freework=yes and $job=getuser and $getuser!=$empty
activefreew=$empty
freeworkcnt=!recordcnt wimshome/log/classes/$wims_class/freeworks/.freeworks
!for k=1 to $freeworkcnt
t=!record $k of wimshome/log/classes/$wims_class/freeworks/.freeworks
st_=!line 1 of $t
!if $st_ isitemof 1,2
ty_=!line 6 of $t
!if $ty_=3 or $ty_=2
!readproc adm/freework/finduserwork.proc $k,$getuser
!if $(output)!=0
activefreew=!append item $k to $activefreew
!endif
!endif
!endif
!next k
!endif
!set nbfreeworks=!itemcnt $activefreew
m=!record 1 of wimshome/log/classes/$wims_class/.grades
!distribute lines $m into manual,titles,weights
gcnt=!itemcnt $titles
gcnt=$[$gcnt-2]
!if $gcnt<1
manual=0
!else
mwtot=0
!for g=1 to $gcnt
w$g=!item $g+2 of $weights
mwtot=$[$mwtot+$(w$g)]
!next g
!endif
!! need g_ for freeworks
!!
!! NOTE: for large classes adm/class/grades (i.e. manual score
!! interfaces) is not available, but freeworks scoring works anyway
!! and scores assigned to freeworks are visibile in this page.
!!
!if $manual>0 or $nbfreeworks>0
uucnt=!recordcnt wimshome/log/classes/$wims_class/.grades
!for u=2 to $uucnt
l_=!record $u of wimshome/log/classes/$wims_class/.grades
n_=!item 1 of $l_
!if $n_=$getuser
teacher=!item 3 to -1 of $l_
!break
!endif
!next u
mav=0
!for i=1 to $gcnt
g_$i=!item $i of $teacher
!if $(g_$i)!=$empty
mav=$[$mav+($(g_$i))*($(w$i))]
!endif
!next i
mav=$[rint(100*$mav/$mwtot)/100]
!else
mav=0
!endif
t=!translate = to , in $wims_req_time
t=!item -1 of $t
means=!record 0 of wimshome/log/classes/$wims_class/scoreavg
topscores=!record 0 of wimshome/log/classes/$wims_class/.scoretop
topnb=!defof class_topscores\
class_limit\
class_hideaverage in wimshome/log/classes/$wims_class/.def
!distribute line $topnb into topnb,classnb,class_hideaverage
!for ic=1 to $classnb
UU=!line $ic of $topscores
UU1=!item 4 of $UU
VV=!append line $UU1 to $VV
WW=!append line $UU to $WW
!next ic
VV=!sort reverse numeric line $VV
!readdef wimshome/log/classes/$wims_class/.def
!default class_topscores=0
!for s=1 to $class_topscores
ic=!item $s of $wims_sort_order
LL=!line $ic of $WW
TT=!append line $LL to $TT
!next s
ot=!line 1 of $means
!if $ot=$empty or $ot<$t-3
!read var.avg
!if $class_type notwordof 2 3 4
!if $class_topscores>0
!read var.topscores
!endif
!endif
!endif
l=!line 2 of $means
!distribute words $l into\
min_auto,mean_auto,max_auto,\
min_tea,mean_tea,max_tea,\
min_glob,mean_glob,max_glob
c=!linecnt $means
!for i=3 to $c
l=!line $i of $means
s=!word 1 of $l
!distribute words $l into x0_,min_$s,mean_$s,max_$s
!next i
uu=$getuser
!read adm/class/userscore
globalav=$[rint($manual*$mav+((100-$manual)*$per))/100]
exologs=!filelist $wims_home/log/classes/$wims_class/exolog/$getuser
!readproc adm/vfilter/listvarfilter.proc
!readproc adm/class/userdef ,$wims_class,$getuser
!readproc adm/vfilter/uservarfilter.proc $userdef
!else
job=
!endif
!if $wims_user=supervisor
!read var.proc.userexam
!endif