Subversion Repositories wimsdev

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
17780 czzmrn 1
!! define global variable for a single freework
2
!! (cfr. adm/class/freework/proc/mkglobalvar.proc)
3
!!
4
!! input: freework number
5
fw_=!item 1 of $wims_read_parm
6
!!
7
!! ($wims_class must be defined)
8
!if $wims_class=$empty
9
  !debug error
10
!endif
11
!!
12
!! -------------- check right for download/upload participant file and etc... (see description below)
13
!! define variables :
14
!! loadwork=1 supervisor can download/see user work
15
!! nbcopies : number of student deposit work
16
!! nbcorrectedcopies : number of work corrected by supervisor
17
!! notcorrected : difference between last two values
18
!! putworkco=1 supervisor can modify/delete global correction file
19
!! putiworkco=1 supervisor can upload individual correction/remark/score
20
!! displaysolution=1 student can download general solution
21
!! codownload=1 student can view/download personal solution/marking
22
!! this variable can be use in subfile of each type
23
!!
24
!! fwtype
25
 
26
t_=!record $fw_ of wimshome/log/classes/$wims_class/freeworks/.freeworks
27
 
28
!distribute line $t_ into activetest,expdate,title,desc,comment,fwtype,deadline,soldate,sizelimitfile,scoring,seealltime,studentclose
29
 
30
nbuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
31
!reset ulist
32
!for fwuu=1 to $nbuser
33
  u_=!record $fwuu of wimshome/log/classes/$wims_class/.userlist
34
  !distribute item $u_ into l_,f_,n_
35
  ulist=!append item $n_ to $ulist
36
!next fwuu
37
 
38
!for fwval in deadline,soldate
39
  t=!replace internal . by , in $($fwval)
40
  !distribute item $t into $fwval,time$fwval
41
  !default $fwval=$today
42
  !default time$fwval=00:00
43
!next fwval
44
!bound activetest between 0 and 3
45
 
46
!! end of work date
47
d1=!text select char 0123456789 in $(deadline)$(timedeadline)
48
!! show solution date
49
d2=!text select char 0123456789 in $(soldate)$(timesoldate)
50
now=!text select char 0123456789 in $wims_now
51
now=!char 1 to 12 of $now
52
!distribute item 0,0 into loadwork,putworkco
53
!if $activetest=1 and $fwtype>1 and ($now>$d1 or $seealltime=1)
54
  loadwork=1
55
!endif
56
!if $activetest>=1
57
  !if $activetest isitemof 1
58
    !distribute item 0,0,0,0 into putworkco,putiworkco,displaysolution,codownload
59
    !if $fwtype>=1
60
      !! ----- make directories in case of download an active freeworks in classe using module=config job=restore/save  
61
      !sh mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work;\
62
          mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co;
63
      !! ------- compute number of copies / corrected copies
64
      !if $fwtype=2
65
        n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work/ | cut -d. -f1;
66
        n2=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co/ | cut -d. -f1;
67
      !else
68
        n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$fw_/work/ | cut -d- -f1 | sort | uniq;
69
        !! count correction by teachers (only count saved after deadline)
70
        n2=!sh cd $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co;\
71
               find * -newermt '$deadline $timedeadline' 2> /dev/null | sort | uniq;
72
!!        n2=!filelist $wims_home/log/classes/$wims_class/freeworksdata/$fw_/co
73
      !endif
74
      n1=!lines2items $n1
75
      n1=!listintersection $n1 and $ulist
76
      nbcopies=!itemcnt $n1
77
      n2=!lines2items $n2
78
      n2=!listintersection $n2 and $ulist
79
      nbcorrectedcopies=!itemcnt $n2
80
    !else
81
      nbcorrectedcopies=0
82
      nbcopies=0
83
    !endif
84
    notcorrected=$[$nbcopies-$nbcorrectedcopies]
85
    !if $now<$d2
86
      putworkco=1
87
    !else
88
      displaysolution=1
89
    !endif
90
    !if ($notcorrected>0 or $now<$d2) and $fwtype>1 and $now>=$d1
91
        putiworkco=1
92
    !endif
93
    !if $now>=$d2 and $notcorrected=0 and $fwtype>1
94
        codownload=1
95
    !endif
96
  !else
97
    putworkco=0
98
    putiworkco=0
99
    loadwork=1
100
    displaysolution=1
101
    codownload=0
102
  !endif
103
  !! ---  general solution diffused if solutiondate pass or activetest>=2
104
  !if $now>$d2 or $activetest>=2
105
    displaysolution=1
106
  !endif
107
!endif
108
!if $activetest=0
109
  loadwork=0
110
  putworkco=1
111
  putiworkco=0
112
  displaysolution=0
113
  codownload=0
114
!endif
115
!! ------- globalcorrection can be modified all time:
116
putworkco=1
117