Subversion Repositories wimsdev

Rev

Rev 16618 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9719 bpr 1
!default uu=$wims_read_parm
2
 
3
!!! perhaps should be a command in wims.c ?
4
!!! variables which are necessary : wims_class, checksessions
5
!!! FIXME max of session number
9878 bpr 6
!!! do reset only if the variable is non empty, if not it creates a variable
7
!!! and gives some "variable_name_buffer_overflow"
16696 bpr 8
max_exams=!defof MAX_EXAMS in wimshome/public_html/bases/sys/define.conf
9878 bpr 9
 
9719 bpr 10
!for i in $activexams
12555 bpr 11
  !if $(Dureeexam_$i)!=$empty
12
    !reset Dureeexam_$i
13
  !endif
14
  !if $(Dureeexam_$i)!=$empty
15
    !reset Dureeexam_$i
16
  !endif
16696 bpr 17
  !for jj=1 to $max_exams
12555 bpr 18
    !! jj correspond to maximum of number sessions
19
    !if $(duree$(jj)_$(i))!=$empty
20
      !reset duree$(jj)_$(i)
21
    !endif
22
    !if $(exam_$jj)!=$empty
23
     !reset exam_$jj
24
    !endif
25
    !! jj correspond to exos in an exam
26
    !if $(exam$(i)_$jj)!=$empty
27
      !reset exam$(i)_$jj
28
    !endif
15569 bpr 29
    !if $(sess_$jj)!=$empty
30
      !reset sess_$jj
31
    !endif
16148 guerimand 32
  !next jj
33
!next i
9719 bpr 34
 
16148 guerimand 35
!! -------- reduce file length with only concerned session before wims action
36
  tmp_=$empty
37
  checksessions=!text select char 0123456789AZERTYUIOPMLKJHGFDSQWXCVBN,azertyuiopmlkjhgfdsqwxcvbn in $checksessions
38
  !for k_ in $checksessions
39
    tmp_=!append word a["$k_"]=0; to $tmp_
16378 guerimand 40
    !reset ip_$(k_)
16148 guerimand 41
  !next k_
16618 guerimand 42
  !sh if [ -e $wims_home/log/classes/$wims_class/score/$uu.exam ]; then awk 'BEGIN{$tmp_} {if ($$6 in a || ($$6=="0" && flag==1)){print $$0; flag=1;} else {flag=0};}' $wims_home/log/classes/$wims_class/score/$uu.exam > $wims_home/sessions/$wims_session/tmpuser.exam; fi;
16148 guerimand 43
!! ---------------------
44
sc=!record 0 of wimshome/sessions/$wims_session/tmpuser.exam
45
!!sc=!record 0 of wimshome/log/classes/$wims_class/score/$uu.exam
10019 bpr 46
!if $sc=$empty
47
  !exit
48
!endif
16378 guerimand 49
 
9719 bpr 50
nsc=!linecnt $sc
16378 guerimand 51
!reset scorereducedbyip
9719 bpr 52
!for i=1 to $nsc
53
  l=!line $i of $sc
54
  !distribute words $l into e_,s_,t__,T_,i_,S_,t_
10019 bpr 55
  !if $S_=0
56
    !reset jj
57
  !else
58
    !set jj=!positionof item $S_ in $checksessions
16378 guerimand 59
    !if $(ip_$jj)=$i_
60
        scoreip$(jj)_$e_=$s_
61
    !endif
10019 bpr 62
    !set score$(jj)_$e_=$s_
63
    !set exam_$jj=!append item $e_ to $(exam_$jj)
15569 bpr 64
    !set sess_$e_=!append item $jj to $(sess_$e_)
10019 bpr 65
    !set exam_$jj=!listuniq $(exam_$jj)
66
    !if $s_ issametext 00
67
      start$(jj)_$e_=$t_
68
      dur$(jj)_$e_=$T_
16378 guerimand 69
      ip_$jj=$i_
10019 bpr 70
    !endif
71
    !if $t__ issametext -1
72
      duree$(jj)_$(e_)=$[$T_ - $(dur$(jj)_$e_)]
16378 guerimand 73
      !if $(score$(jj)_$e_)!=$(scoreip$(jj)_$e_)
74
        scorereducedbyip=1
75
      !endif
10019 bpr 76
    !endif
9719 bpr 77
  !endif
16148 guerimand 78
!next i
9719 bpr 79
!for i in $activexams
12555 bpr 80
  !if $(Dureeexam_$i)!=$empty
81
    !reset Dureeexam_$i
9878 bpr 82
  !endif
16696 bpr 83
  !for e=1 to $max_exams
12555 bpr 84
    !if $(Exam_$(i)_$(e))!=$empty
85
      !reset Exam_$(i)_$(e)
86
    !endif
87
    !if $(exam$(i)_$e)!=$empty
88
      !reset exam$(i)_$e
89
    !endif
16148 guerimand 90
  !next e
12555 bpr 91
  !for ses_ in $checksessions
92
    !set jj=!positionof item $ses_ in $checksessions
93
    !if $(duree$(jj)_$i)!=$empty
94
      Dureeexam_$i=!append item $(duree$(jj)_$i) to $(Dureeexam_$i)
95
    !endif
16148 guerimand 96
  !next ses_
9719 bpr 97
!next
98
 
99
!!details des notes examens par session
100
!for ses_ in $checksessions
12555 bpr 101
  !set jj=!positionof item $ses_ in $checksessions
102
  !set ss=!sh grep "$ses_" $wims_home/log/classes/$wims_class/noscore/$uu | grep "score" | awk -F"\t" '{print $$1}' | awk -F" " '{print $$3,$$4,$$6}'
103
  !set ss=!lines2rows $ss
104
  !set ss=!words2items $ss
105
  !!perhaps several different exams in one session.
106
  !for i in $(exam_$(jj))
107
    !set s_=!select $ss where column 1=$i
108
    !set nbx=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$i
109
    !for k_=1 to $nbx
110
      !reset s
111
      !set s=!select $s_ where column 2=$k_
112
      !set s=$(s[3])
113
      !if $s!=$empty
114
        !set s=$[rint($s*$scoremax)/10]
115
      !endif
116
      !set Exam_$(i)_$(jj)=$(Exam_$(i)_$(jj)) $s,
117
    !next
118
  !next
9719 bpr 119
!next