Subversion Repositories wimsdev

Rev

Rev 17470 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17070 guerimand 1
!! -------- check user
2
user=$wims_user
3
clsfile=wimshome/log/classes/$wims_class/swork/averagescore
4
Clsfile=$wims_home/log/classes/$wims_class/swork/averagescore
5
ufile=wimshome/log/classes/$wims_class/swork/averagescore.$user
6
Ufile=$wims_home/log/classes/$wims_class/swork/averagescore.$user
7
time1=!record 0 of $ufile
17097 guerimand 8
time1=!line 1 of $time1
17070 guerimand 9
!distribute word $time1 into time1,majdate,bl
10
!default time1=0
17145 guerimand 11
test=!fileexists $ufile
12
!if $test=yes and ($[$wims_nowseconds-$time1]<3600*$swork_refreshtiming or ($swork_allowrefresh=1 and $refresh!=1))
17070 guerimand 13
  !exit
14
!endif
17306 guerimand 15
!readproc proc/loguserwork.proc $user
17070 guerimand 16
time2=!record 0 of $clsfile
17
time2=!word 1 of $time2
18
!default time2=0
19
!if $[$wims_nowseconds-$time2]<3600
20
  userlist=$user
21
!else
22
  !reset userlist
23
  !for k=1 to $nbuser
24
    d=!record $k of wimshome/log/classes/$wims_class/.userlist
25
    userlist=!append item $(d[3]) to $userlist
26
  !next k
27
  !writefile $clsfile $wims_nowseconds $wims_now
17151 guerimand 28
  !! generation indice de difficulte of each exercise
29
  !sh export exostat_dirbase exostat_types exostat_classes\
30
    exostat_dirbase=$wims_home/log/classes\
31
    exostat_types="score"\
32
    exostat_classes="$wims_class"\
33
    ../bin/exostat >$wims_home/log/classes/$wims_class/exostat
34
  !reset indice
35
  t=!recordcnt wimshome/log/classes/$wims_class/exostat
36
  ms=1
37
  me=0
38
  max=0
39
  !for k=1 to $t
40
    dt=!record $k of wimshome/log/classes/$wims_class/exostat
41
    !distribute word $dt into bl,s,e,bl,bl,bl,bl,bl,bl,bl,bl,bl,bl,bl,bl,i
42
    !if $s>$ms
43
      ne=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$ms
44
      me=!itemcnt $ligne
45
      !ifval $me<$ne
46
        !for j=1 to $[$ne-$me]
47
          ligne=!append item - to $ligne
48
        !next j
49
      !endif
50
      indice=!append line $ligne to $indice
51
      !reset ligne
52
      ms=$s
53
      me=0
54
    !endif
55
    !ifval $e>$me+1
56
      !for j=1 to $[$e-$me-1]
57
        ligne=!append item - to $ligne
58
      !next j
59
    !endif
60
    !if $i>0
61
      ligne=!append item $i to $ligne
62
      max=$[max($max,$i)]
63
    !else
64
      ligne=!append item - to $ligne
65
    !endif
66
    me=$e
67
  !next k
17070 guerimand 68
  time2=yes
17151 guerimand 69
  !! ------ fin de generation
70
  indice=!replace internal - by $max in $indice
17070 guerimand 71
!endif
17149 guerimand 72
time1=$wims_nowseconds
17151 guerimand 73
!writefile $ufile $wims_nowseconds $wims_now 10000000
17070 guerimand 74
majdate=$wims_now
75
nbuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
76
!for sh=1 to $nbsheet
17097 guerimand 77
  dtsh=!record $sh of wimshome/log/classes/$wims_class/sheets/.sheets
17070 guerimand 78
  stat=!line 1 of $dtsh
79
  !if $stat!=0
80
    nbexo=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sh
81
    average=!values 0 for v=1 to $nbexo
17150 guerimand 82
    count=$average
17070 guerimand 83
    max=$average
17150 guerimand 84
    average2=$average
17097 guerimand 85
    lsev=!line $[$sh+1] of $severity
17070 guerimand 86
    !distribute word $lsev into swei,rule,indic
17097 guerimand 87
    formula=!item $rule of $formulas
17070 guerimand 88
    wei=!getscoreweight user=$user sheet=$sh
89
    wei=!words2items $wei
90
    totwei=!replace internal , by + in $wei
91
    totwei=$[$totwei]
92
    !reset useraverage
93
    !for dtu in $userlist
17097 guerimand 94
      lq=!getscoremean user=$dtu sheet=$sh
17070 guerimand 95
      !if $indic=0
96
        li=!getscore user=$dtu sheet=$sh
17358 guerimand 97
        re=!getscorerequire user=$dtu sheet=$sh
17070 guerimand 98
      !else
99
        !if $indic=1
17097 guerimand 100
          li=!getscorebest user=$dtu sheet=$sh
17358 guerimand 101
          re=!getscorerequire user=$dtu sheet=$sh
17070 guerimand 102
        !else
103
          li=!getscorelevel user=$dtu sheet=$sh
17358 guerimand 104
          re=!values 1 for v=1 to $nbexo
105
          re=!items2words $re
17070 guerimand 106
        !endif
107
      !endif
108
      !!calcul du score pour chaque exo
17150 guerimand 109
      !reset lave lmax lcount lave2
17070 guerimand 110
      !for k=1 to $nbexo
111
        ewei=!word $k of $wei
112
        elq=!word $k of $lq
113
        eli=!word $k of $li
17358 guerimand 114
        rei=!word $k of $re
115
        !if $rei!=0
116
          ave=!replace internal I by $[$eli/10/$rei] in $formula
117
        !else
118
          ave=!replace internal I by 1 in $formula
119
        !endif
17097 guerimand 120
        ave=!replace internal Q by $[$elq/10] in $ave
121
        ave=$[rint($ave*1000)]
17070 guerimand 122
        !if $dtu=$user
123
          useraverage=!append item $ave to $useraverage
124
        !endif
17358 guerimand 125
        try=!getscoretry user=$dtu sheet=$sh work=$k
18169 bpr 126
        !if $try>0
17150 guerimand 127
          cnt=$[$(count[$k])+1]
128
          lcount=!append item $cnt to $lcount
129
        !else
130
          lcount=!append item $(count[$k]) to $lcount
131
        !endif
17070 guerimand 132
        lmax=!append item $[max($ave,$(max[$k]))] to $lmax
133
        ave=$[$(ave)+$(average[$k])]
134
        lave=!append item $ave to $lave
135
      !next k
17150 guerimand 136
      count=$lcount
17070 guerimand 137
      average=$lave
138
      max=$lmax
139
    !next dtu
140
    !reset tmp tmp2
141
    !if $time2!=yes
142
      tmp=!record $sh of $clsfile
143
    !endif
144
    !for k=1 to $nbexo
145
      !if $time2=yes
17097 guerimand 146
        ave=$[rint($(average[$k])/$nbuser)]
17470 guerimand 147
        !if $(count[$k])!=0
148
          ave2=$[rint($(average[$k])/$(count[$k]))]
149
        !else
150
          ave2=0
151
        !endif
17097 guerimand 152
        m=$[rint($(max[$k]))]
17151 guerimand 153
        ind=$(indice[$sh;$k])
154
        tmp=!append line $sh $k $ave $m $ave2 $ind to $tmp
17070 guerimand 155
      !else
156
        ave=!line $k of $tmp
157
        m=!word 4 of $ave
17150 guerimand 158
        ave2=!word 5 of $ave
17151 guerimand 159
        ind=!word 6 of $ave
17470 guerimand 160
        !default ind=1
17070 guerimand 161
        ave=!word 3 of $ave
162
      !endif
163
      !if $(wei[$k])!=0 and $swei!=0
17151 guerimand 164
        val=$[rint(100*($ave - $(useraverage[$k])) *$swei * $(wei[$k])/($totwei*$ind))]
17097 guerimand 165
        !if $val<=0
17070 guerimand 166
          val=-1000
167
        !endif
168
      !else
169
        !if $swei!=0
170
          val=$[-10000*$swei]
171
        !else
172
          val=-10000
173
        !endif
174
      !endif
17151 guerimand 175
      m2=$[rint(100*($m - $(useraverage[$k])) *$swei * $(wei[$k])/($totwei*$ind))]
17150 guerimand 176
      !appendfile $ufile :$sh $k $val $m2 $ave $m $ave2
17070 guerimand 177
    !next k
178
    !if $time2=yes
179
      !appendfile $clsfile :$tmp
180
    !endif
181
  !else
182
    !if $time2=yes
18169 bpr 183
      !appendfile $clsfile :
17070 guerimand 184
    !endif
185
  !endif
186
!next sh
187
 
188
!sh sort -n -r -k 3 -k 4 $Ufile > $wims_home/sessions/$wimss_session/tmp.swork;\
189
    mv -f $wims_home/sessions/$wimss_session/tmp.swork $Ufile