Subversion Repositories wimsdev

Rev

Rev 17151 | Rev 17358 | Go to most recent revision | 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
97
      !else
98
        !if $indic=1
17097 guerimand 99
          li=!getscorebest user=$dtu sheet=$sh
17070 guerimand 100
        !else
101
          li=!getscorelevel user=$dtu sheet=$sh
102
        !endif
103
      !endif
104
      !!calcul du score pour chaque exo
17150 guerimand 105
      !reset lave lmax lcount lave2
17070 guerimand 106
      !for k=1 to $nbexo
107
        ewei=!word $k of $wei
108
        elq=!word $k of $lq
109
        eli=!word $k of $li
17097 guerimand 110
        ave=!replace internal I by $[$eli/10] in $formula
111
        ave=!replace internal Q by $[$elq/10] in $ave
112
        ave=$[rint($ave*1000)]
17070 guerimand 113
        !if $dtu=$user
114
          useraverage=!append item $ave to $useraverage
115
        !endif
17150 guerimand 116
        try=!getscorealltries user=$dtu sheet=$sh work=$k
117
        !if $try>0          
118
          ave2=$[$(ave)+$(average2[$k])]
119
          lave2=!append item $ave2 to $lave2
120
          cnt=$[$(count[$k])+1]
121
          lcount=!append item $cnt to $lcount
122
        !else
123
          lave2=!append item $(average2[$k]) to $lave2
124
          lcount=!append item $(count[$k]) to $lcount
125
        !endif
17070 guerimand 126
        lmax=!append item $[max($ave,$(max[$k]))] to $lmax
127
        ave=$[$(ave)+$(average[$k])]
128
        lave=!append item $ave to $lave
17150 guerimand 129
        lave=!append item $(average[$k]) to $lave
130
        lcount=!append item $(count[$k]) to $lcount
17070 guerimand 131
      !next k
17150 guerimand 132
      count=$lcount
17070 guerimand 133
      average=$lave
17150 guerimand 134
      average2=$lave2
17070 guerimand 135
      max=$lmax
136
    !next dtu
137
    !reset tmp tmp2
138
    !if $time2!=yes
139
      tmp=!record $sh of $clsfile
140
    !endif
141
    !for k=1 to $nbexo
142
      !if $time2=yes
17097 guerimand 143
        ave=$[rint($(average[$k])/$nbuser)]
17150 guerimand 144
        ave2=$[rint($(average[$k])/$(count[$k]))]
17097 guerimand 145
        m=$[rint($(max[$k]))]
17151 guerimand 146
        ind=$(indice[$sh;$k])
147
        tmp=!append line $sh $k $ave $m $ave2 $ind to $tmp
17070 guerimand 148
      !else
149
        ave=!line $k of $tmp
150
        m=!word 4 of $ave
17150 guerimand 151
        ave2=!word 5 of $ave
17151 guerimand 152
        ind=!word 6 of $ave
17070 guerimand 153
        ave=!word 3 of $ave
154
      !endif
155
      !if $(wei[$k])!=0 and $swei!=0
17151 guerimand 156
        val=$[rint(100*($ave - $(useraverage[$k])) *$swei * $(wei[$k])/($totwei*$ind))]
17097 guerimand 157
        !if $val<=0
17070 guerimand 158
          val=-1000
159
        !endif
160
      !else
161
        !if $swei!=0
162
          val=$[-10000*$swei]
163
        !else
164
          val=-10000
165
        !endif
166
      !endif
17151 guerimand 167
      m2=$[rint(100*($m - $(useraverage[$k])) *$swei * $(wei[$k])/($totwei*$ind))]
17150 guerimand 168
      !appendfile $ufile :$sh $k $val $m2 $ave $m $ave2
17070 guerimand 169
    !next k
170
    !if $time2=yes
171
      !appendfile $clsfile :$tmp
172
    !endif
173
  !else
174
    !if $time2=yes
175
      !appendfile $clsfile : 
176
    !endif
177
  !endif
178
!next sh
179
 
180
!sh sort -n -r -k 3 -k 4 $Ufile > $wims_home/sessions/$wimss_session/tmp.swork;\
181
    mv -f $wims_home/sessions/$wimss_session/tmp.swork $Ufile
182