Rev 15607 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10368 | bpr | 1 | |
2691 | czzmrn | 2 | quote=" |
3 | fbase=data-$wims_class |
||
4 | fbase=!translate internal / to _ in $fbase |
||
5 | fname=wimshome/$wims_sesdir/spreadsheet.$csvformat |
||
6 | dl=!singlespace $csvdownload |
||
10516 | guerimand | 7 | !! no needed because no keyword are now directly writing and incompatible with techvar code name |
8 | !!dl=!lower $dl |
||
9513 | bpr | 9 | !if login notin $dl |
10 | dl=login,$dl |
||
11 | !endif |
||
2691 | czzmrn | 12 | !for t in average,sheet,exam,manual |
12467 | bpr | 13 | dl=!replace $t $ by $t in $dl |
2691 | czzmrn | 14 | !next t |
15 | dl=!items2words $dl |
||
16 | dl=!replace word names by name in $dl |
||
17 | dl=!replace grade by manual in $dl |
||
18 | dl=!replace word allscores by allscore in $dl |
||
19 | dl=!replace word name by lastname firstname in $dl |
||
20 | dl=!replace word allscore by averages sheets exams manuals in $dl |
||
7364 | bpr | 21 | dl_tmp=$dl |
2691 | czzmrn | 22 | |
8452 | guerimand | 23 | !readproc csv/keyword.proc |
9909 | obado | 24 | |
9513 | bpr | 25 | tmp=!column 2 to -1 of $se |
26 | tmp=!lines2words $tmp |
||
27 | tmp=!items2words $tmp |
||
28 | tmp=!singlespace $tmp |
||
29 | |||
11145 | bpr | 30 | good=$basic $av $sh $ex $ma $examduration $tmp $basic2 $basic3 |
9719 | bpr | 31 | tmp=!column 2 to -1 of $exe |
32 | |||
33 | tmp=!lines2words $tmp |
||
34 | tmp=!items2words $tmp |
||
35 | tmp=!singlespace $tmp |
||
36 | good=$good $tmp |
||
37 | |||
2691 | czzmrn | 38 | dl=!replace word averages by $av in $dl |
39 | dl=!replace word sheets by $sh in $dl |
||
40 | dl=!replace word exams by $ex in $dl |
||
41 | dl=!replace word manuals by $ma in $dl |
||
8452 | guerimand | 42 | !if sheetexos isin $dl |
14088 | bpr | 43 | tmp=!column 2 to -1 of $se |
44 | tmp=!lines2words $tmp |
||
45 | dl=!replace word sheetexos by $tmp in $dl |
||
8452 | guerimand | 46 | !else |
47 | !for i in $activesh |
||
48 | !if sheetexo$i iswordof $dl |
||
9513 | bpr | 49 | tmp=!select $se where column 1 = $i |
50 | dl=!replace word sheetexo$i by $(tmp[2..-1]) in $dl |
||
8452 | guerimand | 51 | dl=!replace word sheetexo$i by in $dl |
52 | !endif |
||
53 | !next i |
||
54 | !endif |
||
7364 | bpr | 55 | |
9719 | bpr | 56 | !! aoption all for examexos, non active |
57 | !!!if examexos isin $dl |
||
58 | !! tmp=!column 2 to -1 of $exe |
||
59 | !! tmp=!lines2words $tmp |
||
60 | !! dl=!replace word examexos by $tmp in $dl |
||
61 | !!!else |
||
12467 | bpr | 62 | !for i in $activexams |
15602 | bpr | 63 | !set nb_ses$i=!record $i of wimshome/log/classes/$wims_class/exams/.exams |
64 | !set nb_ses$i=!line 3 of $(nb_ses$i) |
||
65 | !set nb_ses$i=!word 2 of $(nb_ses$i) |
||
12467 | bpr | 66 | !if examexo$i iswordof $dl |
67 | tmp=!select $exe where column 1 = $i |
||
68 | dl=!replace word examexo$i by $(tmp[2..-1]) in $dl |
||
69 | dl=!replace word examexo$i by in $dl |
||
70 | !endif |
||
71 | !next i |
||
9719 | bpr | 72 | !!!endif |
2691 | czzmrn | 73 | dl=!words2items $dl |
74 | dl=!listuniq $dl |
||
9719 | bpr | 75 | |
10382 | guerimand | 76 | good=!words2items $good,$regvarlist |
10383 | bpr | 77 | !! only techvar should be in dl_v other variable have to stay in good |
78 | !! (generic traitement for name) |
||
2691 | czzmrn | 79 | dl_v =!listcomplement $good in $dl |
80 | !if $dl_v!= |
||
10378 | guerimand | 81 | dl_var=$empty |
82 | !for k in $dl_v |
||
10382 | guerimand | 83 | realname=!replace internal techvar_ by $empty in $k |
84 | dl_var=!append item $(code_user_techvar_$(realname)) to $dl_var |
||
10378 | guerimand | 85 | !next k |
2691 | czzmrn | 86 | !endif |
87 | dl=!listintersect $dl and $good |
||
88 | dl=!nospace $dl |
||
89 | dl_var=!nospace $dl_var |
||
90 | dl_v=!nospace $dl_v |
||
91 | dlcnt=!itemcnt $dl |
||
92 | !if $dlcnt=0 |
||
14088 | bpr | 93 | !exit |
2691 | czzmrn | 94 | !endif |
10044 | georgesk | 95 | |
2691 | czzmrn | 96 | sep_csv=, |
10044 | georgesk | 97 | sep_ods=; |
10940 | obado | 98 | sep_xls=; |
2691 | czzmrn | 99 | sep_tsv=$ $ |
100 | sep=$(sep_$csvformat) |
||
101 | dl2=!replace , by ,user_ in user_$dl |
||
102 | dl2=!translate , to $sep in $dl2 |
||
10017 | guerimand | 103 | |
104 | !if $dl_var!=$empty |
||
12467 | bpr | 105 | dl4=!replace , by ,user_ in user_$dl_v |
106 | dl4=$sep$dl4 |
||
107 | dl5=$sep$dl5 |
||
108 | dl=$dl$sep$dl_var |
||
2691 | czzmrn | 109 | !endif |
10017 | guerimand | 110 | |
2691 | czzmrn | 111 | tit=!translate , to $sep in $dl |
15602 | bpr | 112 | !for i=1 to $examcnttot |
113 | tmp=!makelist : for x=1 to $(nb_ses$i) |
||
114 | tmp=!items2words $tmp |
||
115 | tit=!replace internal exam$i by exam$i$tmp$ in $tit |
||
116 | !next |
||
10383 | bpr | 117 | !! quote the values (case of word groups) |
10405 | bpr | 118 | !for n in login,password,lastname,firstname,email,regnum,comments,\ |
10383 | bpr | 119 | participate,supervise,supervisable,external_auth,average0,average1,average2 |
120 | dl2=!replace user_$n by $(quote)user_$n$quote in $dl2 |
||
2691 | czzmrn | 121 | !next n |
10405 | bpr | 122 | !if $regvarlist!=$empty |
123 | !for n in $regvarlist |
||
124 | dl2=!replace user_$n by $(quote)user_$n$quote in $dl2 |
||
125 | !next n |
||
126 | !endif |
||
10021 | guerimand | 127 | dl4r=!items2words $dl4 |
10017 | guerimand | 128 | !if $dl4!=$empty |
12467 | bpr | 129 | dl4=!replace , by $(quote),$(quote) in $(quote)$dl4$(quote) |
130 | dl4=!char 3 to -1 of $dl4 |
||
131 | dl5=!replace user_ by $$name_user_ in $dl4 |
||
132 | dl4=!replace user_ by $$user_ in $dl4 |
||
10017 | guerimand | 133 | !else |
12467 | bpr | 134 | dl5=$empty |
10017 | guerimand | 135 | !endif |
2691 | czzmrn | 136 | dl3=!replace user_ by $$name_ in $dl2 |
137 | dl2=!replace user_ by $$user_ in $dl2 |
||
10005 | guerimand | 138 | |
2691 | czzmrn | 139 | scores=no |
140 | !if average isin $dl or manual isin $dl or sheet isin $dl or exam isin $dl |
||
12467 | bpr | 141 | scores=yes |
2691 | czzmrn | 142 | !endif |
143 | |||
9909 | obado | 144 | !read csv/csvnames |
2691 | czzmrn | 145 | !writefile $fname $tit\ |
146 | $dl3$dl5\ |
||
147 | |||
9912 | obado | 148 | !reset data_scores |
2691 | czzmrn | 149 | !for u=1 to $usercnt |
12467 | bpr | 150 | !! reinitialise variables of type user_ |
151 | !reset user_lastname,user_firstname,user_email,user_regnum,user_comments,\ |
||
152 | user_external_auth,user_supervise,user_participate,user_supervisable |
||
153 | !for n in $regvarlist |
||
154 | !reset user_$n |
||
155 | !next |
||
156 | l=!record $u of wimshome/log/classes/$wims_class/.userlist |
||
157 | user_login=!item 3 of $l |
||
158 | uu=$user_login |
||
159 | uuu=!hex $uu |
||
160 | !reset $basic,$dl4r |
||
161 | !read adm/class/userdef classes,$wims_class,$user_login |
||
162 | !defread $userdef |
||
163 | user_participate=!items2words $user_participate |
||
164 | user_supervise=!items2words $user_supervise |
||
165 | !if $scores=yes |
||
166 | !read adm/class/userscore $uu |
||
167 | user_average1=$per |
||
168 | user_average2=$(manual_$uuu) |
||
169 | !if average0 isitemof $dl |
||
170 | user_average0=$[rint($manual*$user_average2+(100-$manual)*($per))/100] |
||
2691 | czzmrn | 171 | !endif |
12467 | bpr | 172 | !for i=1 to $sheetcnttot |
173 | !if sheet$i isitemof $dl and $i isitemof $activesh |
||
174 | p_=!line $i of $percents |
||
175 | !distribute words $p_ into p1,p2,p3,p4 |
||
176 | !if $p2!=$empty |
||
177 | ###f_$i is defined by var.proc.weights |
||
178 | !distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_ |
||
179 | !set ff_$i=!mathsubst Q=$y_ in $(f_$i) |
||
180 | !for sev=0 to 2 |
||
181 | !set ff_$i=!mathsubst I$sev=$(x$(sev)_) in $(ff_$i) |
||
182 | !next |
||
16198 | bpr | 183 | !! adm/class/userscore/getuser.phtml |
184 | !! home/sequence.phtml |
||
185 | !! themes/_widgets/usersheet.phtml |
||
12467 | bpr | 186 | user_sheet$i=$[rint(100*$scoremax*$(ff_$i))/100] |
187 | !else |
||
188 | user_sheet$i=0 |
||
189 | !endif |
||
190 | !endif |
||
191 | !next i |
||
192 | !for i=1 to $sheetcnttot |
||
193 | !if sheet$(i)_exo isin $dl and $i isitemof $activesh |
||
194 | !let e_=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i |
||
195 | !for k_ = 1 to $e_ |
||
196 | d_=!getscore user=$uu sheet=$i work=$k_ |
||
197 | dd_=!getscorerequire user=$uu sheet=$i work=$k_ |
||
198 | m_=!getscoremean user=$uu sheet=$i work=$k_ |
||
199 | b_=!getscorebest user=$uu sheet=$i work=$k_ |
||
200 | l_=!getscorelevel user=$uu sheet=$i work=$k_ |
||
201 | user_sheet$(i)_exo_$(k_)_Q=$[$m_] |
||
202 | user_sheet$(i)_exo_$(k_)_I0=$[ceil(100*$d_/$dd_)] |
||
203 | user_sheet$(i)_exo_$(k_)_I1=$[ceil(100*$b_/$dd_)] |
||
204 | user_sheet$(i)_exo_$(k_)_I2=$[$l_] |
||
205 | !next k_ |
||
206 | !endif |
||
207 | !next |
||
15602 | bpr | 208 | !if _exexo_ isin $dl or examduration isin $dl or exam isin $dl |
12467 | bpr | 209 | logdir=$wims_home/log/classes/$wims_class/examlog/$uu |
210 | checksessions=!sh if [ -d $logdir ]; then cd $logdir; ls -tr; fi |
||
211 | checksessions=!words2items $checksessions |
||
212 | !read adm/class/userscore1 $uu |
||
213 | !endif |
||
214 | !for i=1 to $examcnttot |
||
215 | !if exam$i isitemof $dl and $i isitemof $activexams |
||
216 | user_exam$i=$[rint(10*$scoremax*$(es_$i))/100] |
||
15602 | bpr | 217 | !set tmp=!listuniq $(sess_$i) |
218 | !for j in $tmp |
||
15607 | bpr | 219 | !set user_exam$i=$(user_exam$i):$[rint(10*$scoremax*$(score$(j)_$i))/100] |
15602 | bpr | 220 | !next |
221 | !set tmp=!itemcnt $tmp |
||
222 | !for j= $tmp+1 to $(nb_ses$i) |
||
223 | !set user_exam$i=$(user_exam$i): |
||
224 | !next |
||
12467 | bpr | 225 | !endif |
226 | !if examduration$i isitemof $dl and $i isitemof $activexams |
||
227 | user_examduration$i=!replace internal , by $ $ in $quote$(Dureeexam_$i)$quote |
||
228 | !endif |
||
229 | !if exam$(i)_exexo isin $dl and $i isitemof $activexams |
||
230 | !set nb_ses=!record $i of wimshome/log/classes/$wims_class/exams/.exams |
||
231 | !set nb_ses=!line 3 of $nb_ses |
||
232 | !set nb_ses=!word 2 of $nb_ses |
||
233 | !let e_=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$i |
||
234 | !set checksessions_cnt=!itemcnt $checksessions |
||
235 | !for k_ = 1 to $e_ |
||
236 | !reset t_ |
||
237 | !set n_ses=0 |
||
238 | !for ses=1 to $checksessions_cnt |
||
239 | !if $i isitemof $(exam_$ses) |
||
240 | !set tmp=$(Exam_$(i)_$ses) |
||
10019 | bpr | 241 | !set t_=$t_$(tmp[$k_]), |
242 | !increase n_ses |
||
12467 | bpr | 243 | !endif |
244 | !next |
||
245 | !set t_=$(t_[1..-2]) |
||
246 | !if $nb_ses>$n_ses |
||
247 | !set oo=!makelist $ $ for x=1 to $[$nb_ses-$n_ses-1] |
||
248 | !! leave the space ! useful for some spreadsheet |
||
249 | !set t_=$t_ ,$oo |
||
9719 | bpr | 250 | !endif |
12467 | bpr | 251 | !set user_exam$(i)_exexo_$(k_)=!replace internal , by : in $t_ |
9719 | bpr | 252 | !next |
12467 | bpr | 253 | !endif |
14088 | bpr | 254 | !next i |
12467 | bpr | 255 | !for i=1 to $gcnt |
256 | !if manual$i isitemof $dl |
||
257 | user_manual$i=!item $i of $(Manual_$uuu) |
||
14341 | guerimand | 258 | !! !default user_manual$i=0 can have no score and don't replace by 0 |
12467 | bpr | 259 | !endif |
260 | !next i |
||
261 | !endif |
||
262 | tmp=!trim $dl4 |
||
263 | !appendfile $fname $dl2$tmp |
||
264 | data_scores=!append item $dl2$tmp to $data_scores |
||
2691 | czzmrn | 265 | !next u |
266 | |||
10941 | bpr | 267 | infile=spreadsheet.$csvformat |
268 | outfile=$fbase.$csvformat |
||
10940 | obado | 269 | !if $csvformat iswordof ods |
12467 | bpr | 270 | !! it is format ods |
271 | !mexec csv/mkODS.py |
||
10044 | georgesk | 272 | !else |
12467 | bpr | 273 | !! it is format csv/tsv/xls |
274 | !mexec csv/getprep.sh |
||
10044 | georgesk | 275 | !endif |