Rev 17780 | Blame | Compare with Previous | Last modification | View Log | RSS feed
!! define global variable can be used in all file
!! -------------- 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 géneral solution
!! codownload=1 student can view/download personal solution/marking
!! this variable can be use in subfile of each type
!!
!! 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 $type>1 and ($now>$d1 or $seealltime=1)
loadwork=1
!endif
!if $activetest>=1
!if $activetest=1
!distribute item 0,0,0,0 into putworkco,putiworkco,displaysolution,codownload
!if $type>=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/$freework/work;\
mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$freework/co;
!! ------- compute number of copies / corrected copies
!if $type=2
n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$freework/work/ | cut -d. -f1;
n2=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$freework/co/ | cut -d. -f1;
!else
n1=!sh dir -1 $wims_home/log/classes/$wims_class/freeworksdata/$freework/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/$freework/co;\
find * -newermt '$deadline $timedeadline' 2> /dev/null | sort | uniq;
!! n2=!filelist $wims_home/log/classes/$wims_class/freeworksdata/$freework/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 $type>1 and $now>=$d1
putiworkco=1
!endif
!if $now>=$d2 and $notcorrected=0 and $type>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