Subversion Repositories wimsdev

Rev

Rev 11140 | Rev 12467 | 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
13
 dl=!replace $t $ by $t in $dl
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
9513 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
62
  !for i in $activexams
63
    !if examexo$i iswordof $dl
64
      tmp=!select $exe where column 1 = $i
65
      dl=!replace word examexo$i by $(tmp[2..-1]) in $dl
66
      dl=!replace word examexo$i by  in $dl
67
    !endif
68
  !next i
69
!!!endif
2691 czzmrn 70
dl=!words2items $dl
71
dl=!listuniq $dl
9719 bpr 72
 
10382 guerimand 73
good=!words2items $good,$regvarlist
10383 bpr 74
!! only techvar should be in dl_v other variable have to stay in good
75
!! (generic traitement for name)
2691 czzmrn 76
dl_v =!listcomplement $good in $dl
77
!if $dl_v!=
10378 guerimand 78
  dl_var=$empty
79
  !for k in $dl_v
10382 guerimand 80
    realname=!replace internal techvar_ by $empty in $k
81
    dl_var=!append item $(code_user_techvar_$(realname)) to $dl_var
10378 guerimand 82
  !next k
2691 czzmrn 83
!endif
84
dl=!listintersect $dl and $good
85
dl=!nospace $dl
86
dl_var=!nospace $dl_var
87
dl_v=!nospace $dl_v
88
dlcnt=!itemcnt $dl
89
!if $dlcnt=0
90
 !exit
91
!endif
10044 georgesk 92
 
2691 czzmrn 93
sep_csv=,
10044 georgesk 94
sep_ods=;
10940 obado 95
sep_xls=;
2691 czzmrn 96
sep_tsv=$	$
97
sep=$(sep_$csvformat)
98
dl2=!replace , by ,user_ in user_$dl
99
dl2=!translate , to $sep in $dl2
10017 guerimand 100
 
101
!if $dl_var!=$empty
102
   dl4=!replace , by ,user_ in user_$dl_v
2691 czzmrn 103
   dl4=$sep$dl4
104
   dl5=$sep$dl5
105
   dl=$dl$sep$dl_var
106
!endif
10017 guerimand 107
 
10405 bpr 108
tit=!replace internal , by $quote,$quote in $quote$tit$quote
2691 czzmrn 109
tit=!translate , to $sep in $dl
10383 bpr 110
!! quote the values (case of word groups)
10405 bpr 111
!for n in login,password,lastname,firstname,email,regnum,comments,\
10383 bpr 112
  participate,supervise,supervisable,external_auth,average0,average1,average2
113
  dl2=!replace user_$n by $(quote)user_$n$quote in $dl2
2691 czzmrn 114
!next n
10405 bpr 115
!if $regvarlist!=$empty
116
  !for n in $regvarlist
117
    dl2=!replace user_$n by $(quote)user_$n$quote in $dl2
118
  !next n
119
!endif
10021 guerimand 120
dl4r=!items2words $dl4
10017 guerimand 121
!if $dl4!=$empty
122
 dl4=!replace , by $(quote),$(quote) in $(quote)$dl4$(quote)
123
 dl4=!char 3 to -1 of $dl4
124
 dl5=!replace user_ by $$name_user_ in $dl4
125
 dl4=!replace user_ by $$user_ in $dl4
126
!else
127
 dl5=$empty
128
!endif
2691 czzmrn 129
dl3=!replace user_ by $$name_ in $dl2
130
dl2=!replace user_ by $$user_ in $dl2
10005 guerimand 131
 
2691 czzmrn 132
scores=no
133
!if average isin $dl or manual isin $dl or sheet isin $dl or exam isin $dl
134
 scores=yes
135
!endif
136
 
9909 obado 137
!read csv/csvnames
2691 czzmrn 138
!writefile $fname $tit\
139
$dl3$dl5\
140
 
9912 obado 141
!reset data_scores
2691 czzmrn 142
!for u=1 to $usercnt
10383 bpr 143
!! reinitialise variables of type user_
5151 bpr 144
 !reset user_lastname,user_firstname,user_email,user_regnum,user_comments,\
8057 bpr 145
     user_external_auth,user_supervise,user_participate,user_supervisable
10383 bpr 146
 !for n in $regvarlist
147
   !reset user_$n
148
 !next
2691 czzmrn 149
 l=!record $u of wimshome/log/classes/$wims_class/.userlist
150
 user_login=!item 3 of $l
151
 uu=$user_login
152
 uuu=!hex $uu
10021 guerimand 153
 !reset $basic,$dl4r
2691 czzmrn 154
 !read adm/class/userdef classes,$wims_class,$user_login
155
 !defread $userdef
10021 guerimand 156
 user_participate=!items2words $user_participate
157
 user_supervise=!items2words $user_supervise
2691 czzmrn 158
 !if $scores=yes
7364 bpr 159
  !read adm/class/userscore $uu
2691 czzmrn 160
  user_average1=$per
161
  user_average2=$(manual_$uuu)
162
  !if average0 isitemof $dl
163
   user_average0=$[rint($manual*$user_average2+(100-$manual)*($per))/100]
164
  !endif
4633 bpr 165
  !for i=1 to $sheetcnttot
4634 bpr 166
   !if sheet$i isitemof $dl and $i isitemof $activesh
2691 czzmrn 167
    p_=!line $i of $percents
7664 bpr 168
    !distribute words $p_ into p1,p2,p3,p4
2691 czzmrn 169
    !if $p2!=$empty
7364 bpr 170
###f_$i is defined by var.proc.weights
7664 bpr 171
     !distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_
172
     !set ff_$i=!mathsubst Q=$y_ in $(f_$i)
173
     !for sev=0 to 2
174
       !set ff_$i=!mathsubst I$sev=$(x$(sev)_) in $(ff_$i)
175
     !next
8250 bpr 176
     user_sheet$i=$[rint(100*$scoremax*$(ff_$i))/100]
2691 czzmrn 177
    !else
178
     user_sheet$i=0
179
    !endif
180
   !endif
181
  !next i
7364 bpr 182
  !for i=1 to $sheetcnttot
9513 bpr 183
   !if sheet$(i)_exo isin $dl and $i isitemof $activesh
7364 bpr 184
    !let e_=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
185
    !for k_ = 1 to $e_
186
      d_=!getscore user=$uu sheet=$i work=$k_
187
      dd_=!getscorerequire user=$uu sheet=$i work=$k_
188
      m_=!getscoremean user=$uu sheet=$i work=$k_
7649 bpr 189
      b_=!getscorebest user=$uu sheet=$i work=$k_
7664 bpr 190
      l_=!getscorelevel user=$uu sheet=$i work=$k_
191
      user_sheet$(i)_exo_$(k_)_Q=$[$m_]
192
      user_sheet$(i)_exo_$(k_)_I0=$[ceil(100*$d_/$dd_)]
193
      user_sheet$(i)_exo_$(k_)_I1=$[ceil(100*$b_/$dd_)]
194
      user_sheet$(i)_exo_$(k_)_I2=$[$l_]
7364 bpr 195
    !next k_
196
   !endif
197
  !next
9719 bpr 198
  !if _exexo_ isin $dl or examduration isin $dl
199
    logdir=$wims_home/log/classes/$wims_class/examlog/$uu
200
    checksessions=!sh if [ -d $logdir ]; then cd $logdir; ls -tr; fi
201
    checksessions=!words2items $checksessions
202
    !read adm/class/userscore1 $uu
203
  !endif
4633 bpr 204
  !for i=1 to $examcnttot
4634 bpr 205
   !if exam$i isitemof $dl and $i isitemof $activexams
9719 bpr 206
     user_exam$i=$[rint(10*$scoremax*$(es_$i))/100]
2691 czzmrn 207
   !endif
9719 bpr 208
   !if examduration$i isitemof $dl and $i isitemof $activexams
209
      user_examduration$i=!replace internal , by $ $ in $quote$(Dureeexam_$i)$quote
210
   !endif
211
   !if exam$(i)_exexo isin $dl and $i isitemof $activexams
212
     !set nb_ses=!record $i of wimshome/log/classes/$wims_class/exams/.exams
213
     !set nb_ses=!line 3 of $nb_ses
214
     !set nb_ses=!word 2 of $nb_ses
215
     !let e_=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$i
216
     !set checksessions_cnt=!itemcnt $checksessions
217
     !for k_ = 1 to $e_
218
        !reset t_
10019 bpr 219
        !set n_ses=0
9719 bpr 220
        !for ses=1 to $checksessions_cnt
10018 bpr 221
          !if $i isitemof $(exam_$ses)
9719 bpr 222
            !set tmp=$(Exam_$(i)_$ses)
10019 bpr 223
            !set t_=$t_$(tmp[$k_]),
224
            !increase n_ses
9719 bpr 225
          !endif
226
        !next
10019 bpr 227
        !set t_=$(t_[1..-2])
228
        !if $nb_ses>$n_ses
229
          !set oo=!makelist $ $ for x=1 to $[$nb_ses-$n_ses-1]
230
!! leave the space ! useful for some spreadsheet
231
          !set t_=$t_ ,$oo
232
        !endif
233
        !set user_exam$(i)_exexo_$(k_)=!replace internal , by : in $t_
9719 bpr 234
      !next
235
    !endif
2691 czzmrn 236
  !next i
237
  !for i=1 to $gcnt
238
   !if manual$i isitemof $dl
239
    user_manual$i=!item $i of $(Manual_$uuu)
240
    !default user_manual$i=0
241
   !endif
242
  !next i
243
 !endif
10021 guerimand 244
 tmp=!trim $dl4
245
 !appendfile $fname $dl2$tmp
246
 data_scores=!append item $dl2$tmp to $data_scores
2691 czzmrn 247
!next u
248
 
10941 bpr 249
infile=spreadsheet.$csvformat
250
outfile=$fbase.$csvformat
10940 obado 251
!if $csvformat iswordof ods
252
 !! it is format ods
253
 !mexec csv/mkODS.py
10044 georgesk 254
!else
10941 bpr 255
 !! it is format csv/tsv/xls
10940 obado 256
 !mexec csv/getprep.sh
10044 georgesk 257
!endif