File: mkfwglobvar.proc

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (122 lines) | stat: -rw-r--r-- 4,425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
!! define global variable for a single freework
!! (cfr. adm/class/freework/proc/mkglobalvar.proc)
!!
!! input: freework number
fw_=!item 1 of $wims_read_parm
!!
!! ($wims_class must be defined)
!if $wims_class=$empty
  !debug error
!endif
!!
!! -------------- check right for download/upload participant file and etc... (see description below)
!! define variables :
!! loadwork=1 supervisor can download/see user work
!! nbcopies : number of student deposit work
!! nbcorrectedcopies : number of work corrected by supervisor
!! notcorrected : difference between last two values
!! putworkco=1 supervisor can modify/delete global correction file
!! putiworkco=1 supervisor can upload individual correction/remark/score
!! displaysolution=1 student can download general solution
!! codownload=1 student can view/download personal solution/marking
!! this variable can be use in subfile of each type
!!
!! fwtype

t_=!record $fw_ of wimshome/log/classes/$wims_class/freeworks/.freeworks

!distribute line $t_ into activetest,expdate,title,desc,comment,fwtype,deadline,soldate,sizelimitfile,scoring,seealltime,studentclose

nbuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
!reset ulist
!for fwuu=1 to $nbuser
  u_=!record $fwuu of wimshome/log/classes/$wims_class/.userlist
  !distribute item $u_ into l_,f_,n_
  ulist=!append item $n_ to $ulist
!next fwuu

!for fwval in deadline,soldate
  t=!replace internal . by , in $($fwval)
  !distribute item $t into $fwval,time$fwval
  !default $fwval=$today
  !default time$fwval=00:00
!next fwval
!bound activetest between 0 and 3
        
!! end of work date
d1=!text select char 0123456789 in $(deadline)$(timedeadline)
!! show solution date
d2=!text select char 0123456789 in $(soldate)$(timesoldate)
now=!text select char 0123456789 in $wims_now
now=!char 1 to 12 of $now
!distribute item 0,0 into loadwork,putworkco
!if $activetest=1 and $fwtype>1 and ($now>$d1 or $seealltime=1)
  loadwork=1
!endif
!if $activetest>=1
  !if $activetest isitemof 1
    !distribute item 0,0,0,0 into putworkco,putiworkco,displaysolution,codownload
    !if $fwtype>=1
      !! ----- make directories in case of download an active freeworks in classe using module=config job=restore/save  
      !sh mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work;\
          mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co;
      !! ------- compute number of copies / corrected copies
      !if $fwtype=2
        n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work/ | cut -d. -f1;
        n2=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co/ | cut -d. -f1;
      !else
        n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work/ | cut -d- -f1 | sort | uniq;
        !! count correction by teachers (only count saved after deadline)
        n2=!sh cd $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co;\
               find * -newermt '$deadline $timedeadline' 2> /dev/null | sort | uniq;
!!        n2=!filelist $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co
      !endif
      n1=!lines2items $n1
      n1=!listintersection $n1 and $ulist
      n2=!lines2items $n2
      n2=!listintersection $n2 and $ulist
      !! at this point n1 is the set of "consigned" works and n2 is
      !! the set of "corrected" works (corresponding to real students
      !! in $ulist). We need to check that n1 is a subset of n2 (can
      !! happen that teachers writes comment to not consigned works)
      testn=!listintersection $n1 and $n2
      nbcopies=!itemcnt $n1
      nbcorrectedcopies=!itemcnt $testn
    !else
      nbcorrectedcopies=0
      nbcopies=0
    !endif
    notcorrected=$[$nbcopies-$nbcorrectedcopies]
    !if $now<$d2
      putworkco=1
    !else
      displaysolution=1
    !endif
    !if ($notcorrected>0 or $now<$d2) and $fwtype>1 and $now>=$d1
        putiworkco=1
    !endif
    !if $now>=$d2 and $notcorrected=0 and $fwtype>1
        codownload=1
    !endif
  !else
    putworkco=0
    putiworkco=0
    loadwork=1
    displaysolution=1
    codownload=0
  !endif
  !! ---  general solution diffused if solutiondate pass or activetest>=2
  !if $now>$d2 or $activetest>=2
    displaysolution=1
  !endif
!endif
!if $activetest=0
  loadwork=0
  putworkco=1
  putiworkco=0
  displaysolution=0
  codownload=0
!endif
!! ------- globalcorrection can be modified all time:
putworkco=1