Subversion Repositories wimsdev

Rev

Rev 16509 | Rev 17468 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

scoremax=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
scoremax=!line 1 of $scoremax
!default scoremax=10

!for e=1 to $exocnt
  got$e=0
  gotip$e=0
  replied$e=0
  ip$e=$empty
!next e

p=!recordcnt wimshome/$wims_sesdir/examscore.$exam
reg=!record 0 of wimshome/$wims_sesdir/examreg.$exam

!if $allowtype=simulation or $wims_user=supervisor
  class_examscore_withoutip=yes
!else
  class_examscore_withoutip=!defof class_examscore_withoutip in wimshome/log/classes/$wims_class/.def
!endif
!if $class_examscore_withoutip!=yes
  start_ip=!sh awk '{if ($$6=="$wims_session" && $$2=="00") print $$5;}' $wims_home/log/classes/$wims_class/score/$wims_user.exam
!endif

replycnt=0
!reset scorereducedbyip
!for i=1 to $p
  l=!record $i of wimshome/$wims_sesdir/examscore.$exam
  !distribute words $l into a_,b_,c_,d_,e_,f_,g_,i_
  !if $c_=score and $(replied$b_)=0
    got$b_=$d_
    ip$b_=$e_
    !if $class_examscore_withoutip!=yes and $start_ip!=$e_
      gotip$b_=0
      scorereducedbyip=1
    !else
      gotip$b_=$d_
    !endif
    replied$b_=1
    !advance replycnt
  !endif
!next i

totgot=0
totgotip=0
totweight=0
!for e=1 to $exocnt
  l=!record $e of wimshome/log/classes/$wims_class/exams/.exam$exam
  w=!word 1 of $l
  weight$e=$w
  totweight=$[$totweight+$w]
  totgot=$[$totgot+$w*$(got$e)]
  totgotip=$[$totgotip+$w*$(gotip$e)]
  dd=!append line $w $totgot to $dd
!next e

!if $totweight>0
  score=$[rint((100-10*$sprime)*$totgot/$totweight+100*$sprime)/100]
  scoreip=$[rint((100-10*$sprime)*$totgotip/$totweight+100*$sprime)/100]
!else
  score=$sprime
!endif

!writefile wimshome/$wims_sesdir/examdata.$exam $sdure $sprime
registered=!record 0 of wimshome/$wims_sesdir/examreg.$exam
now=$wims_nowseconds

!if $registered>0
  timeleft=$[60*$sdure-($now-$registered)]
!endif

!if $registered>-1
  !! le temps restant affiche ne peut pas aller au dela de la limitation fixee par la limitation de feuille.
  !set expir_user=!record 0 of wimshome/log/classes/$wims_class/.E$exam
  !set cle=!word 1 of $expir_user
  !! process for technical variable definition (replace expir_user by value given by the technical variable)
  !if \ isin $cle
    !set idtechvar=!line 1 of $expir_user
    !set idtechvar=!char 2 to -1 of $idtechvar
    !readproc adm/class/userdef ,$wims_class,$wims_user
    !set val=!defof user_techvar_$(idtechvar) in $userdef
    !default val=EMPTY
    !reset expir_user
    !set expir_user=!defof techvar_$val in wimshome/log/classes/$wims_class/.E$exam
    !default expir_user=none
  !endif
  !! end process technical variable
  !if $expir_user!=none
    expir_user=!words2items $expir_user
    nb=!itemcnt $expir_user
    fin=$empty
    c=<
    !for k=1 to $nb
      !if $c isin $(expir_user[$k])
        fin=!char 2 to -1 of $(expir_user[$k])
        fin=!text select 0123456789.: in $fin
      !endif
    !next k
    !if $fin!=$empty
      date=!char 1 to 8 of $fin
      time=!char 10 to 14 of $fin
      dt=!sh date -d"$date $time" +%s
      left=$[$dt-$now]
      !if $registered>0
        timeleft=$[min($timeleft,$left)]
      !endif
    !endif
  !endif
  !! fin des modifications qui decoule de la limitation fixee par la feuille

!endif
!if $timeleft<0
  timeleft=0
!endif
wims_exam_remain=$timeleft
rm=$[floor($timeleft/60)]
rs=!char 2,3 of $[$timeleft%60+100]
remaintext=$rm:$rs

l=!examscore
lastscore=!word $exam of $l
!default lastscore=0
tr=!line $exam+1 of $l
!distribute words $tr into tr1, tried, trcut
!if $tried=0
  trcut=1
!endif
tryremain=$[$stries-$tried]
!if $trcut=0
  tryremain=0
!endif
!ifval $left!=$empty and $left <= $[min($timeleft+60*$sdure*($tryremain),$left)]
  time_end=!exec get_end_date.pl $left,%T
  warning=yes
!endif

t_=!getscorestatus sheet=$exam exam=yes