Subversion Repositories wimsdev

Rev

Rev 17780 | Details | Compare with Previous | 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
      n2=!lines2items $n2
77
      n2=!listintersection $n2 and $ulist
18179 czzmrn 78
      !! at this point n1 is the set of "consigned" works and n2 is
79
      !! the set of "corrected" works (corresponding to real students
80
      !! in $ulist). We need to check that n1 is a subset of n2 (can
81
      !! happen that teachers writes comment to not consigned works)
82
      testn=!listintersection $n1 and $n2
83
      nbcopies=!itemcnt $n1
84
      nbcorrectedcopies=!itemcnt $testn
17780 czzmrn 85
    !else
86
      nbcorrectedcopies=0
87
      nbcopies=0
88
    !endif
89
    notcorrected=$[$nbcopies-$nbcorrectedcopies]
90
    !if $now<$d2
91
      putworkco=1
92
    !else
93
      displaysolution=1
94
    !endif
95
    !if ($notcorrected>0 or $now<$d2) and $fwtype>1 and $now>=$d1
96
        putiworkco=1
97
    !endif
98
    !if $now>=$d2 and $notcorrected=0 and $fwtype>1
99
        codownload=1
100
    !endif
101
  !else
102
    putworkco=0
103
    putiworkco=0
104
    loadwork=1
105
    displaysolution=1
106
    codownload=0
107
  !endif
108
  !! ---  general solution diffused if solutiondate pass or activetest>=2
109
  !if $now>$d2 or $activetest>=2
110
    displaysolution=1
111
  !endif
112
!endif
113
!if $activetest=0
114
  loadwork=0
115
  putworkco=1
116
  putiworkco=0
117
  displaysolution=0
118
  codownload=0
119
!endif
120
!! ------- globalcorrection can be modified all time:
121
putworkco=1
122