Subversion Repositories wimsdev

Rev

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