Subversion Repositories wimsdev

Rev

Rev 4626 | Rev 9909 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4626 obado 1
# GetScores
2
# Fournit les notes de la classes, separees par le caractere associe au format specifie
4561 obado 3
# NB : a comparer avec "Download" et GetCSV ?
3261 obado 4
 
5
!bound format within csv, tsv, xls default xls
6
 
7
!read scripts/check.class
8
!if $error!=$empty
9
 !exit
10
!endif
11
 
12
usercnt=!recordcnt wimshome/log/classes/$qclass/.userlist
13
 
14
!default option=login,name,allscores
15
 
16
quote="
17
 
18
 
19
dl=!singlespace $option
20
dl=!lower $dl
21
!for t in average,sheet,exam,manual
22
 dl=!replace $t $ by $t in $dl
23
!next t
24
dl=!items2words $dl
25
dl=!replace word names by name in $dl
26
dl=!replace grade by manual in $dl
27
dl=!replace word allscores by allscore in $dl
28
dl=!replace word name by lastname firstname in $dl
29
dl=!replace word allscore by averages sheets exams manuals in $dl
30
 
31
good=login password lastname firstname email regnum comments
32
scnt=!recordcnt wimshome/log/classes/$qclass/sheets/.sheets
33
activesh=
34
!for i=1 to $scnt
35
 l=!record $i of wimshome/log/classes/$qclass/sheets/.sheets
36
 l=!word 1 of $l
37
 !if $l>0
38
  activesh=!append item $i to $activesh
39
 !endif
40
!next i
41
sheetcnt=!itemcnt $activesh
42
sh=
43
!for i in $activesh
44
 sh=$sh sheet$i
45
 l=!record $i of wimshome/log/classes/$qclass/sheets/.sheets
46
 name=!line 3 of $l
47
 name_sheet$i=$quote$name$quote
48
!next i
49
good=$good $sh
50
 
51
scnt=!recordcnt wimshome/log/classes/$qclass/exams/.exams
52
activexams=
53
!for i=1 to $scnt
54
 l=!record $i of wimshome/log/classes/$qclass/exams/.exams
55
 l=!word 1 of $l
56
 !if $l>0
57
  activexams=!append item $i to $activexams
58
 !endif
59
!next i
60
examcnt=!itemcnt $activexams
61
ex=
62
!for i in $activexams
63
 ex=$ex exam$i
64
 l=!record $i of wimshome/log/classes/$qclass/exams/.exams
65
 name=!line 4 of $l
66
 name_exam$i=$quote$name$quote
67
!next i
68
good=$good $ex
69
 
70
l=!record 1 of wimshome/log/classes/$qclass/.grades
71
!distribute lines $l into manual,titles,weights
72
gcnt=!itemcnt $titles
73
gcnt=$[max(0,$gcnt-2)]
74
ma=
75
!for i=1 to $gcnt
76
 ma=$ma manual$i
77
 name=!item $i+2 of $titles
78
 name_manual$i=$quote$name$quote
79
!next i
80
good=$good $ma
81
 
82
av=
83
!if $sheetcnt+$examcnt>0 and $gcnt>0
84
 av=$av average0
85
!endif
86
!if $sheetcnt+$examcnt>0
87
 av=$av average1
88
!endif
89
!if $gcnt>0
90
 av=$av average2
91
!endif
92
good=$good $av
93
 
94
dl=!replace word averages by $av in $dl
95
dl=!replace word sheets by $sh in $dl
96
dl=!replace word exams by $ex in $dl
97
dl=!replace word manuals by $ma in $dl
98
dl=!words2items $dl
99
dl=!listuniq $dl
100
good=!words2items $good
101
dl=!listintersect $dl and $good
102
dl=!nospace $dl
103
dlcnt=!itemcnt $dl
104
!if $dlcnt=0
105
 error=nothing done
106
 !exit
107
!endif
108
 
109
!if $gcnt>0
110
 mwtot=0
111
 !for g=1 to $gcnt
112
   w$g=!item $g+2 of $weights
113
   mwtot=$[$mwtot+$(w$g)]
114
 !next g
115
 uucnt=!recordcnt wimshome/log/classes/$qclass/.grades
116
 !for i=2 to $uucnt
117
   l=!record $i of wimshome/log/classes/$qclass/.grades
118
   n=!item 1 of $l
119
   g=!item 3 to -1 of $l
120
   Manual_$n=$g
121
   mm=0
122
   !for i=1 to $gcnt
123
    g_=!item $i of $g
124
    mm=$[$mm+($(w$i))*($g_)]
125
   !next i
126
   manual_$n=$[rint(100*$mm/$mwtot)/100]
127
 !next i
128
!endif
129
 
130
sep_csv=,
131
sep_xls=;
132
sep_tsv=$	$
133
sep=$(sep_$format)
134
dl2=!replace , by ,user_ in user_$dl
135
dl2=!translate , to $sep in $dl2
136
tit=!replace , by $quote,$quote in $quote$tit$quote
137
tit=!translate , to $sep in $dl
138
!for n in login,password,lastname,firstname,email,regnum,comments
139
 dl2=!replace user_$n by $(quote)user_$n$quote in $dl2
140
!next n
141
dl3=!replace user_ by $$name_ in $dl2
142
dl2=!replace user_ by $$user_ in $dl2
143
 
144
scores=no
145
!if average isin $dl or manual isin $dl or sheet isin $dl or exam isin $dl
146
 scores=yes
147
!endif
148
 
149
!read names.$lang
150
 
151
 
152
 
153
s=!record 0 of wimshome/log/classes/$qclass/sheets/.severity
154
scoremax=!line 1 of $s
155
!default scoremax=20
156
 
8422 czzmrn 157
!read adm/class/sheetweights
3261 obado 158
 
4609 obado 159
class_superclass=!defof class_superclass in $classdeffile
160
#Le dossier des etudiants se situe toujours dans la superclasse
161
!if $class_superclass != $empty
162
	users_dir = wimshome/log/classes/$class_superclass/.users
163
!else
164
	users_dir = wimshome/log/classes/$qclass/.users
165
!endif
166
 
167
 
3261 obado 168
!for u=1 to $usercnt
169
 l=!record $u of wimshome/log/classes/$qclass/.userlist
170
 user_login=!item 3 of $l
4609 obado 171
 !defread $users_dir/$user_login
3261 obado 172
 !if $scores=yes
173
  uu=$user_login
8422 czzmrn 174
  !read adm/class/userscore $user_login
3261 obado 175
  user_average1=$per
176
  user_average2=$(manual_$user_login)
177
  !if average0 isitemof $dl
178
   user_average0=$[rint($manual*$user_average2+(100-$manual)*($per))/100]
179
  !endif
180
  !for i=1 to $sheetcnt
181
   !if sheet$i isitemof $dl
182
    p_=!line $i of $percents
8422 czzmrn 183
!! cfr r7612-r7638 for adm/class/userscore
184
!!   and r7638-r7664
185
    !distribute words $p_ into p1,p2,p3,p4
3261 obado 186
    !if $p2!=$empty
8422 czzmrn 187
     !distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_
188
     !set ff_$i=!mathsubst Q=$y_ in $(f_$i)
189
     !for sev=0 to 2
190
       !set ff_$i=!mathsubst I$sev=$(x$(sev)_) in $(ff_$i)
191
     !next
192
     user_sheet$i=$[rint(100*$scoremax*$(ff_$i))/100]
3261 obado 193
    !else
194
     user_sheet$i=0
195
    !endif
196
   !endif
197
  !next i
198
  !for i=1 to $examcnt
199
   !if exam$i isitemof $dl
200
    user_exam$i=$[rint(10*$scoremax*$(es_$i))/100]
201
   !endif
202
  !next i
203
  !for i=1 to $gcnt
204
   !if manual$i isitemof $dl
205
    user_manual$i=!item $i of $(Manual_$user_login)
206
    !default user_manual$i=0
207
   !endif
208
  !next i
209
 !endif
3996 obado 210
 data_scores=!append item $dl2 to $data_scores
3261 obado 211
 data_csv=!append line $dl2 to $data_csv  
212
!next u
213