Rev 17149 | Rev 17151 | 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 |
||
15 | time2=!record 0 of $clsfile |
||
16 | time2=!word 1 of $time2 |
||
17 | !default time2=0 |
||
18 | !if $[$wims_nowseconds-$time2]<3600 |
||
19 | userlist=$user |
||
20 | !else |
||
21 | !reset userlist |
||
22 | !for k=1 to $nbuser |
||
23 | d=!record $k of wimshome/log/classes/$wims_class/.userlist |
||
24 | userlist=!append item $(d[3]) to $userlist |
||
25 | !next k |
||
26 | !writefile $clsfile $wims_nowseconds $wims_now |
||
27 | time2=yes |
||
28 | !endif |
||
17149 | guerimand | 29 | time1=$wims_nowseconds |
17070 | guerimand | 30 | !writefile $ufile $wims_nowseconds $wims_now 100000 |
31 | majdate=$wims_now |
||
32 | nbuser=!recordcnt wimshome/log/classes/$wims_class/.userlist |
||
33 | !for sh=1 to $nbsheet |
||
17097 | guerimand | 34 | dtsh=!record $sh of wimshome/log/classes/$wims_class/sheets/.sheets |
17070 | guerimand | 35 | stat=!line 1 of $dtsh |
36 | !if $stat!=0 |
||
37 | nbexo=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sh |
||
38 | average=!values 0 for v=1 to $nbexo |
||
17150 | guerimand | 39 | count=$average |
17070 | guerimand | 40 | max=$average |
17150 | guerimand | 41 | average2=$average |
17097 | guerimand | 42 | lsev=!line $[$sh+1] of $severity |
17070 | guerimand | 43 | !distribute word $lsev into swei,rule,indic |
17097 | guerimand | 44 | formula=!item $rule of $formulas |
17070 | guerimand | 45 | wei=!getscoreweight user=$user sheet=$sh |
46 | wei=!words2items $wei |
||
47 | totwei=!replace internal , by + in $wei |
||
48 | totwei=$[$totwei] |
||
49 | !reset useraverage |
||
50 | !for dtu in $userlist |
||
17097 | guerimand | 51 | lq=!getscoremean user=$dtu sheet=$sh |
17070 | guerimand | 52 | !if $indic=0 |
53 | li=!getscore user=$dtu sheet=$sh |
||
54 | !else |
||
55 | !if $indic=1 |
||
17097 | guerimand | 56 | li=!getscorebest user=$dtu sheet=$sh |
17070 | guerimand | 57 | !else |
58 | li=!getscorelevel user=$dtu sheet=$sh |
||
59 | !endif |
||
60 | !endif |
||
61 | !!calcul du score pour chaque exo |
||
17150 | guerimand | 62 | !reset lave lmax lcount lave2 |
17070 | guerimand | 63 | !for k=1 to $nbexo |
64 | ewei=!word $k of $wei |
||
65 | elq=!word $k of $lq |
||
66 | eli=!word $k of $li |
||
17097 | guerimand | 67 | ave=!replace internal I by $[$eli/10] in $formula |
68 | ave=!replace internal Q by $[$elq/10] in $ave |
||
69 | ave=$[rint($ave*1000)] |
||
17070 | guerimand | 70 | !if $dtu=$user |
71 | useraverage=!append item $ave to $useraverage |
||
72 | !endif |
||
17150 | guerimand | 73 | try=!getscorealltries user=$dtu sheet=$sh work=$k |
74 | !if $try>0 |
||
75 | ave2=$[$(ave)+$(average2[$k])] |
||
76 | lave2=!append item $ave2 to $lave2 |
||
77 | cnt=$[$(count[$k])+1] |
||
78 | lcount=!append item $cnt to $lcount |
||
79 | !else |
||
80 | lave2=!append item $(average2[$k]) to $lave2 |
||
81 | lcount=!append item $(count[$k]) to $lcount |
||
82 | !endif |
||
17070 | guerimand | 83 | lmax=!append item $[max($ave,$(max[$k]))] to $lmax |
84 | ave=$[$(ave)+$(average[$k])] |
||
85 | lave=!append item $ave to $lave |
||
17150 | guerimand | 86 | lave=!append item $(average[$k]) to $lave |
87 | lcount=!append item $(count[$k]) to $lcount |
||
17070 | guerimand | 88 | !next k |
17150 | guerimand | 89 | count=$lcount |
17070 | guerimand | 90 | average=$lave |
17150 | guerimand | 91 | average2=$lave2 |
17070 | guerimand | 92 | max=$lmax |
93 | !next dtu |
||
94 | !reset tmp tmp2 |
||
95 | !if $time2!=yes |
||
96 | tmp=!record $sh of $clsfile |
||
97 | !endif |
||
98 | !for k=1 to $nbexo |
||
99 | !if $time2=yes |
||
17097 | guerimand | 100 | ave=$[rint($(average[$k])/$nbuser)] |
17150 | guerimand | 101 | ave2=$[rint($(average[$k])/$(count[$k]))] |
17097 | guerimand | 102 | m=$[rint($(max[$k]))] |
17150 | guerimand | 103 | tmp=!append line $sh $k $ave $m $ave2 to $tmp |
17070 | guerimand | 104 | !else |
105 | ave=!line $k of $tmp |
||
106 | m=!word 4 of $ave |
||
17150 | guerimand | 107 | ave2=!word 5 of $ave |
17070 | guerimand | 108 | ave=!word 3 of $ave |
109 | !endif |
||
110 | !if $(wei[$k])!=0 and $swei!=0 |
||
17097 | guerimand | 111 | val=$[rint($ave - $(useraverage[$k]))] |
17150 | guerimand | 112 | val=$[rint($val *$swei * $(wei[$k])/($totwei))] |
17097 | guerimand | 113 | !if $val<=0 |
17070 | guerimand | 114 | val=-1000 |
115 | !endif |
||
116 | !else |
||
117 | !if $swei!=0 |
||
118 | val=$[-10000*$swei] |
||
119 | !else |
||
120 | val=-10000 |
||
121 | !endif |
||
122 | !endif |
||
17097 | guerimand | 123 | m2=$[rint($m-$(useraverage[$k]))] |
17150 | guerimand | 124 | !appendfile $ufile :$sh $k $val $m2 $ave $m $ave2 |
17070 | guerimand | 125 | !next k |
126 | !if $time2=yes |
||
127 | !appendfile $clsfile :$tmp |
||
128 | !endif |
||
129 | !else |
||
130 | !if $time2=yes |
||
131 | !appendfile $clsfile : |
||
132 | !endif |
||
133 | !endif |
||
134 | !next sh |
||
135 | |||
136 | !sh sort -n -r -k 3 -k 4 $Ufile > $wims_home/sessions/$wimss_session/tmp.swork;\ |
||
137 | mv -f $wims_home/sessions/$wimss_session/tmp.swork $Ufile |
||
138 |