Rev 8422 | 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 |
||
9909 | obado | 3 | # TODO : appeler directement les fonctions de userscore, comme c'est fait avec 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 |
||
9909 | obado | 141 | |
142 | !read csv/csvnames |
||
143 | |||
3261 | obado | 144 | dl3=!replace user_ by $$name_ in $dl2 |
145 | dl2=!replace user_ by $$user_ in $dl2 |
||
146 | |||
147 | scores=no |
||
148 | !if average isin $dl or manual isin $dl or sheet isin $dl or exam isin $dl |
||
149 | scores=yes |
||
150 | !endif |
||
151 | |||
9909 | obado | 152 | !read csv/csvnames |
3261 | obado | 153 | !read names.$lang |
154 | |||
155 | s=!record 0 of wimshome/log/classes/$qclass/sheets/.severity |
||
156 | scoremax=!line 1 of $s |
||
157 | !default scoremax=20 |
||
158 | |||
8422 | czzmrn | 159 | !read adm/class/sheetweights |
3261 | obado | 160 | |
4609 | obado | 161 | class_superclass=!defof class_superclass in $classdeffile |
162 | #Le dossier des etudiants se situe toujours dans la superclasse |
||
163 | !if $class_superclass != $empty |
||
164 | users_dir = wimshome/log/classes/$class_superclass/.users |
||
165 | !else |
||
166 | users_dir = wimshome/log/classes/$qclass/.users |
||
167 | !endif |
||
168 | |||
169 | |||
3261 | obado | 170 | !for u=1 to $usercnt |
171 | l=!record $u of wimshome/log/classes/$qclass/.userlist |
||
172 | user_login=!item 3 of $l |
||
4609 | obado | 173 | !defread $users_dir/$user_login |
3261 | obado | 174 | !if $scores=yes |
175 | uu=$user_login |
||
8422 | czzmrn | 176 | !read adm/class/userscore $user_login |
3261 | obado | 177 | user_average1=$per |
178 | user_average2=$(manual_$user_login) |
||
179 | !if average0 isitemof $dl |
||
180 | user_average0=$[rint($manual*$user_average2+(100-$manual)*($per))/100] |
||
181 | !endif |
||
182 | !for i=1 to $sheetcnt |
||
183 | !if sheet$i isitemof $dl |
||
184 | p_=!line $i of $percents |
||
9909 | obado | 185 | !! cf r7612-r7638 for adm/class/userscore |
8422 | czzmrn | 186 | !! and r7638-r7664 |
187 | !distribute words $p_ into p1,p2,p3,p4 |
||
3261 | obado | 188 | !if $p2!=$empty |
8422 | czzmrn | 189 | !distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_ |
190 | !set ff_$i=!mathsubst Q=$y_ in $(f_$i) |
||
191 | !for sev=0 to 2 |
||
192 | !set ff_$i=!mathsubst I$sev=$(x$(sev)_) in $(ff_$i) |
||
193 | !next |
||
194 | user_sheet$i=$[rint(100*$scoremax*$(ff_$i))/100] |
||
3261 | obado | 195 | !else |
196 | user_sheet$i=0 |
||
197 | !endif |
||
198 | !endif |
||
199 | !next i |
||
200 | !for i=1 to $examcnt |
||
201 | !if exam$i isitemof $dl |
||
202 | user_exam$i=$[rint(10*$scoremax*$(es_$i))/100] |
||
203 | !endif |
||
204 | !next i |
||
205 | !for i=1 to $gcnt |
||
206 | !if manual$i isitemof $dl |
||
207 | user_manual$i=!item $i of $(Manual_$user_login) |
||
208 | !default user_manual$i=0 |
||
209 | !endif |
||
210 | !next i |
||
211 | !endif |
||
3996 | obado | 212 | data_scores=!append item $dl2 to $data_scores |
9909 | obado | 213 | data_csv=!append line $dl2 to $data_csv |
3261 | obado | 214 | !next u |
215 |