Subversion Repositories wimsdev

Rev

Rev 4594 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4594 Rev 12981
Line 4... Line 4...
4
!if ($wims_supertype!=4 and $wims_supertype!=2) or $wims_user!=supervisor
4
!if ($wims_supertype!=4 and $wims_supertype!=2) or $wims_user!=supervisor
5
 !exit
5
  !exit
6
!endif
6
!endif
7
tr_list=
7
tr_list=
8
tr_typename=!defof class_typename in wimshome/log/classes/$wims_class/.def
8
tr_typename=!defof class_typename in wimshome/log/classes/$wims_class/.def
9
tr_l1=!defof user_participate in \
9
tr_l1=!defof user_participate in \
10
	wimshome/log/classes/$wims_superclass/.users/$transfer_user
10
	wimshome/log/classes/$wims_superclass/.users/$transfer_user
11
!if $wims_supertype=4 
11
!if $wims_supertype=4
12
!if $tr_typename=course
12
  !if $tr_typename=course
13
 tr_program=!defof sharing_exam in wimshome/log/classes/$wims_class/neighbors
13
    tr_program=!defof sharing_exam in wimshome/log/classes/$wims_class/neighbors
14
 tr_class=!defof user_class in wimshome/log/classes/$wims_class/.users/$transfer_user
14
    tr_class=!defof user_class in wimshome/log/classes/$wims_class/.users/$transfer_user
15
 !if $tr_class=$empty
15
    !if $tr_class=$empty
16
  tr_parent=!defof class_parent in wimshome/log/classes/$wims_class/.def
16
      tr_parent=!defof class_parent in wimshome/log/classes/$wims_class/.def
17
  !if $tr_parent!=$empty and $tr_parent isitemof $tr_l1
17
      !if $tr_parent!=$empty and $tr_parent isitemof $tr_l1
18
   tr_class=$tr_parent
18
        tr_class=$tr_parent
19
  !endif
19
      !endif
20
 !else
20
    !else
21
  tr_class=$wims_superclass/$tr_class
21
      tr_class=$wims_superclass/$tr_class
22
 !endif
22
    !endif
23
 !if $tr_program!=$empty and $tr_class!=$empty
23
    !if $tr_program!=$empty and $tr_class!=$empty
24
  tr_l2=!record 0 of wimshome/log/classes/$tr_program/courses
24
      tr_l2=!record 0 of wimshome/log/classes/$tr_program/courses
25
  tr_l3=!record 0 of wimshome/log/classes/$tr_program/icourses
25
      tr_l3=!record 0 of wimshome/log/classes/$tr_program/icourses
26
  tr_l2=!append line $tr_l3 to $tr_l2
26
      tr_l2=!append line $tr_l3 to $tr_l2
27
  tr_l2=!column 1 of $tr_l2
27
      tr_l2=!column 1 of $tr_l2
28
  tr_l2=!nonempty items $tr_l2
28
      tr_l2=!nonempty items $tr_l2
29
  tr_l2=!makelist $wims_superclass/x for x in $tr_l2
29
      tr_l2=!makelist $wims_superclass/x for x in $tr_l2
30
  tr_l2=!listcomplement $wims_class in $tr_l2
30
      tr_l2=!listcomplement $wims_class in $tr_l2
31
  tr_list=
31
      tr_list=
32
  !for c_ in $tr_l2
32
      !for c_ in $tr_l2
33
   tr_test1=!defof user_class in \
33
        tr_test1=!defof user_class in \
34
	wimshome/log/classes/$c_/.users/$transfer_user
34
	        wimshome/log/classes/$c_/.users/$transfer_user
35
   tr_test2=!defof sharing_exam in wimshome/log/classes/$c_/neighbors
35
        tr_test2=!defof sharing_exam in wimshome/log/classes/$c_/neighbors
36
   !if $wims_superclass/$tr_test1=$tr_class or \
36
        !if $wims_superclass/$tr_test1=$tr_class or \
37
	$tr_test2=$tr_program
37
	          $tr_test2=$tr_program
38
    tr_list=!append item $c_ to $tr_list
38
          tr_list=!append item $c_ to $tr_list
-
 
39
        !endif
-
 
40
      !next c_
-
 
41
    !endif
-
 
42
  !else
-
 
43
    !if $wims_class notitemof $tr_l1
-
 
44
      !exit
39
   !endif
45
    !endif
-
 
46
    tr_l1=!listcomplement $wims_class in $tr_l1
-
 
47
    !for c_ in $tr_l1
-
 
48
      tr_l2=!defof class_ocourses in wimshome/log/classes/$c_/.def
-
 
49
      tr_l3=!defof user_courses in wimshome/log/classes/$c_/.users/$transfer_user
-
 
50
      tr_l2=!append item $tr_l3 to $tr_l2
-
 
51
      tr_l2=!nonempty items $tr_l2
-
 
52
      !if $tr_l2!=$empty
-
 
53
        tr_l2=!makelist $wims_superclass/x for x in $tr_l2
-
 
54
        tr_list=!append item $tr_l2 to $tr_list
-
 
55
      !endif
40
  !next c_
56
    !next c_
41
 !endif
57
  !endif
42
!else
58
!else
-
 
59
  !! same for wims_supertype=2 build a tr_list analogue to the one above:
-
 
60
  !! suitable classes to look into for activity by $transfer_user
-
 
61
  !if  $wims_supertype=2 and $tr_typename=class
-
 
62
    tr_sharing=!defof sharing_exam in wimshome/log/classes/$wims_class/neighbors
-
 
63
    tr_sharable=!defof sharable_exam in wimshome/log/classes/$wims_class/neighbors
-
 
64
    !! is user_class really used?
-
 
65
    tr_class=!defof user_class in wimshome/log/classes/$wims_class/.users/$transfer_user
43
 !if $wims_class notitemof $tr_l1
66
    !if $tr_class=$empty
-
 
67
      !! case 1 --> $wims_class is not "giving" (tr_sharable=$empty, i.e.
-
 
68
      !!   $tr_sharing!=$empty), need to check whether it is sharing from
-
 
69
      !!   (tr_sharing!=$empty) and need to find classes sharing from the
44
  !exit
70
      !!   same class
-
 
71
      !if $tr_sharing!=$empty
-
 
72
        tr_list=$tr_sharing
45
 !endif
73
        !! altri candidati
-
 
74
        tr_l2=!defof sharable_exam in wimshome/log/classes/$tr_sharing/neighbors
46
 tr_l1=!listcomplement $wims_class in $tr_l1
75
        tr_l2=!listcomplement $wims_class in $tr_l2
-
 
76
        !! controllo che queste effettivamente siano in sharing
47
 !for c_ in $tr_l1
77
        !for c_ in $tr_l2
48
  tr_l2=!defof class_ocourses in wimshome/log/classes/$c_/.def
78
          tr_test=!defof sharing_exam in wimshome/log/classes/$c_/neighbors
49
  tr_l3=!defof user_courses in wimshome/log/classes/$c_/.users/$transfer_user
79
          !if $tr_test=$tr_sharing
50
  tr_l2=!append item $tr_l3 to $tr_l2
80
            tr_list=!append item $c_ to $tr_list
-
 
81
          !endif
51
  tr_l2=!nonempty items $tr_l2
82
        !next c_
-
 
83
      !else
-
 
84
        !! case 2 --> $wims_class is giving resources to other classes
-
 
85
        !! (tr_sharable!=$empty) suitable class are in the ones in
-
 
86
        !! $wims_superclass/.subclasses that have $wims_class in sharing_exams
52
  !if $tr_l2!=$empty
87
        !if $tr_sharable!=$empty
-
 
88
          tr_list=
53
   tr_l2=!makelist $wims_superclass/x for x in $tr_l2
89
          cnt_class=!recordcnt wimshome/log/classes/$wims_superclass/.subclasses
-
 
90
          !for i = 1 to $cnt_class
-
 
91
            cl=!record $i of wimshome/log/classes/.index
-
 
92
            cl_test=$(cl[1])
-
 
93
            cl_sharing=!defof sharing_exam in wimshome/log/classes/$cl_test/neighbors
-
 
94
            !if $cl_sharing=$wims_class
54
   tr_list=!append item $tr_l2 to $tr_list
95
              tr_list=!append item $cl_test to $tr_list
-
 
96
            !endif
-
 
97
          !next
-
 
98
        !endif
-
 
99
      !endif
-
 
100
    !else
-
 
101
      tr_class=$wims_superclass/$tr_class
-
 
102
    !endif
55
  !endif
103
  !endif
56
 !next c_
-
 
57
!endif
104
!endif
-
 
105
 
58
!else
106
!if $tr_list!=$empty
59
!! same for wims_supertype=2 build a tr_list analogue to the one above: 
107
  tr_l1=!makelist x/score for x in $tr_list
60
!! suitable classes to look into for activity by $transfer_user
108
  tr_l2=!makelist x/noscore for x in $tr_list
61
!if  $wims_supertype=2 and $tr_typename=class
109
  tr_l1=!items2words $tr_l1
-
 
110
  tr_l2=!items2words $tr_l2
62
 tr_sharing=!defof sharing_exam in wimshome/log/classes/$wims_class/neighbors
111
  tr_score=!sh cd $wims_home/log/classes\
63
 tr_sharable=!defof sharable_exam in wimshome/log/classes/$wims_class/neighbors
112
  	find $tr_l1 -name $transfer_user -o -name $transfer_user.exam | sed 's!/score/.*$$!!'
64
 !! is user_class really used?
113
  tr_noscore=!sh cd $wims_home/log/classes\
65
 tr_class=!defof user_class in wimshome/log/classes/$wims_class/.users/$transfer_user
114
  	find $tr_l2 -name $transfer_user | sed 's!/noscore/.*$$!!'
66
 !if $tr_class=$empty
115
  tr_score=!words2items $tr_score
67
  !! case 1 --> $wims_class is not "giving" (tr_sharable=$empty, i.e.
116
  tr_noscore=!words2items $tr_noscore
68
  !!   $tr_sharing!=$empty), need to check whether it is sharing from
117
  tr_list=!listunion $tr_score and $tr_noscore
69
  !!   (tr_sharing!=$empty) and need to find classes sharing from the
118
  tr_list=!nonempty items $tr_list
-
 
119
!endif
-
 
120
 
70
  !!   same class 
121
transfer_test=!itemcnt $tr_list
-
 
122
!if $transfer_test<1 or $transfer_cmd=test or\
71
  !if $tr_sharing!=$empty
123
	  $transfer_other notitemof $tr_list
-
 
124
  !exit
-
 
125
!endif
-
 
126
 
72
   tr_list=$tr_sharing
127
!if $wims_supertype=4
-
 
128
  !default tr_program=!defof sharing_exam in wimshome/log/classes/$transfer_other/neighbors
73
   !! altri candidati
129
  !if $tr_typename!=course
74
   tr_l2=!defof sharable_exam in wimshome/log/classes/$tr_sharing/neighbors
130
    tr_l1=!defof class_ocourses in wimshome/log/classes/$wims_class/.def
-
 
131
    tr_l2=!defof user_courses in wimshome/log/classes/$wims_class/.users/$transfer_user
75
   tr_l2=!listcomplement $wims_class in $tr_l2	 
132
    tr_l1=!append item $tr_l2 to $tr_l1
-
 
133
    tr_l1=!nonempty items $tr_l1
76
   !! controllo che queste effettivamente siano in sharing 
134
    tr_l1=!makelist $wims_superclass/x for x in $tr_l1
77
   !for c_ in $tr_l2
135
    !for c in $tr_l1
78
    tr_test=!defof sharing_exam in wimshome/log/classes/$c_/neighbors
136
      tr_pr=!defof sharing_exam in wimshome/log/classes/$c/neighbors
79
    !if $tr_test=$tr_sharing
137
      !if $tr_pr=$tr_program
-
 
138
        tr_this=$c
-
 
139
        !break
-
 
140
      !endif
-
 
141
    !next c
-
 
142
    !if $tr_this=$empty
80
     tr_list=!append item $c_ to $tr_list
143
      error=no_reccourse
-
 
144
      !exit
81
    !endif
145
    !endif
82
   !next c_
-
 
83
  !else
146
  !else
84
   !! case 2 --> $wims_class is giving resources to other classes
-
 
85
   !! (tr_sharable!=$empty) suitable class are in the ones in
-
 
86
   !! $wims_superclass/.subclasses that have $wims_class in sharing_exams
-
 
87
   !if $tr_sharable!=$empty
-
 
88
    tr_list=
-
 
89
    cnt_class=!recordcnt wimshome/log/classes/$wims_superclass/.subclasses
-
 
90
    !for i = 1 to $cnt_class
-
 
91
     cl=!record $i of wimshome/log/classes/.index
-
 
92
     cl_test=$(cl[1])
-
 
93
     cl_sharing=!defof sharing_exam in wimshome/log/classes/$cl_test/neighbors
-
 
94
     !if $cl_sharing=$wims_class
147
    tr_this=$wims_class
95
      tr_list=!append item $cl_test to $tr_list 
-
 
96
     !endif
-
 
97
    !next
-
 
98
   !endif
-
 
99
  !endif
148
  !endif
100
 !else
-
 
101
  tr_class=$wims_superclass/$tr_class
-
 
102
 !endif
-
 
103
!endif
-
 
104
!endif
149
!endif
105
 
150
 
106
!if $tr_list!=$empty
-
 
107
 tr_l1=!makelist x/score for x in $tr_list
-
 
108
 tr_l2=!makelist x/noscore for x in $tr_list
-
 
109
 tr_l1=!items2words $tr_l1
-
 
110
 tr_l2=!items2words $tr_l2
-
 
111
 tr_score=!sh cd $wims_home/log/classes\
-
 
112
	find $tr_l1 -name $transfer_user -o -name $transfer_user.exam | sed 's!/score/.*$$!!'
-
 
113
 tr_noscore=!sh cd $wims_home/log/classes\
-
 
114
	find $tr_l2 -name $transfer_user | sed 's!/noscore/.*$$!!'
-
 
115
 tr_score=!words2items $tr_score
-
 
116
 tr_noscore=!words2items $tr_noscore
-
 
117
 tr_list=!listunion $tr_score and $tr_noscore
-
 
118
 tr_list=!nonempty items $tr_list
-
 
119
!endif
-
 
120
 
-
 
121
transfer_test=!itemcnt $tr_list
-
 
122
!if $transfer_test<1 or $transfer_cmd=test or\
-
 
123
	$transfer_other notitemof $tr_list
-
 
124
 !exit
-
 
125
!endif
-
 
126
 
-
 
127
!if $wims_supertype=4
-
 
128
!default tr_program=!defof sharing_exam in wimshome/log/classes/$transfer_other/neighbors
-
 
129
!if $tr_typename!=course
-
 
130
 tr_l1=!defof class_ocourses in wimshome/log/classes/$wims_class/.def
-
 
131
 tr_l2=!defof user_courses in wimshome/log/classes/$wims_class/.users/$transfer_user
-
 
132
 tr_l1=!append item $tr_l2 to $tr_l1
-
 
133
 tr_l1=!nonempty items $tr_l1
-
 
134
 tr_l1=!makelist $wims_superclass/x for x in $tr_l1
-
 
135
 !for c in $tr_l1
-
 
136
  tr_pr=!defof sharing_exam in wimshome/log/classes/$c/neighbors
-
 
137
  !if $tr_pr=$tr_program
-
 
138
   tr_this=$c
-
 
139
   !break
-
 
140
  !endif
-
 
141
 !next c
-
 
142
 !if $tr_this=$empty
-
 
143
  error=no_reccourse
-
 
144
  !exit
-
 
145
 !endif
-
 
146
!else
-
 
147
 tr_this=$wims_class
-
 
148
!endif
-
 
149
!endif
-
 
150
 
-
 
151
!if $wims_supertype=2 and $tr_typename=class
151
!if $wims_supertype=2 and $tr_typename=class
152
 !if $transfer_other isitemof $tr_list
152
  !if $transfer_other isitemof $tr_list
153
  tr_this=$wims_class
153
    tr_this=$wims_class
154
 !endif
154
  !endif
155
!endif
155
!endif
156
 
156
 
157
tr_c1=log/classes/$transfer_other
157
tr_c1=log/classes/$transfer_other
158
tr_c2=log/classes/$tr_this
158
tr_c2=log/classes/$tr_this
159
!if $transfer_cmd=replace
159
!if $transfer_cmd=replace
160
 mline=cp $tr_c1/score/$transfer_user $tr_c2/score
160
  mline=cp $tr_c1/score/$transfer_user $tr_c2/score
161
!else
161
!else
162
 mline=cat $tr_c1/score/$transfer_user $tr_c2/score/$transfer_user 2>/dev/null >$wims_sesdir/transfer\
162
  mline=cat $tr_c1/score/$transfer_user $tr_c2/score/$transfer_user 2>/dev/null >$wims_sesdir/transfer\
163
  sort <$wims_sesdir/transfer >$tr_c2/score/$transfer_user
163
    sort <$wims_sesdir/transfer >$tr_c2/score/$transfer_user
164
!endif
164
!endif
165
 
165
 
166
!sh cd $wims_home\
166
!sh cd $wims_home\
167
 if [ -f $tr_c1/score/$transfer_user ]; then\
167
 if [ -f $tr_c1/score/$transfer_user ]; then\
168
  $mline\
168
   $mline\
169
 fi\
169
  fi\
170
 if [ -f $tr_c1/noscore/$transfer_user ]; then\
170
  if [ -f $tr_c1/noscore/$transfer_user ]; then\
171
  cat $tr_c1/noscore/$transfer_user $tr_c2/noscore/$transfer_user 2>/dev/null >$wims_sesdir/transfer\
171
   cat $tr_c1/noscore/$transfer_user $tr_c2/noscore/$transfer_user 2>/dev/null >$wims_sesdir/transfer\
172
  sort <$wims_sesdir/transfer >$tr_c2/noscore/$transfer_user\
172
   sort <$wims_sesdir/transfer >$tr_c2/noscore/$transfer_user\
173
 fi\
173
  fi\
174
 if [ -f $tr_c1/score/$transfer_user.exam ]; then\
174
  if [ -f $tr_c1/score/$transfer_user.exam ]; then\
175
  cat $tr_c1/score/$transfer_user.exam >>$tr_c2/score/$transfer_user.exam\
175
   cat $tr_c1/score/$transfer_user.exam >>$tr_c2/score/$transfer_user.exam\
176
 fi\
176
  fi\
177
 if [ -d $tr_c1/examlog/$transfer_user ]; then\
177
  if [ -d $tr_c1/examlog/$transfer_user ]; then\
178
  mkdir -p $tr_c2/examlog\
178
   mkdir -p $tr_c2/examlog\
179
  mv -f $tr_c1/examlog/$transfer_user $tr_c2/examlog\
179
   mv -f $tr_c1/examlog/$transfer_user $tr_c2/examlog\
180
 fi\
180
  fi\
181
 if [ -d $tr_c1/exolog/$transfer_user ]; then\
181
  if [ -d $tr_c1/exolog/$transfer_user ]; then\
182
  mkdir -p $tr_c2/exolog\
182
    mkdir -p $tr_c2/exolog\
183
  mv -f $tr_c1/exolog/$transfer_user $tr_c2/exolog\
183
    mv -f $tr_c1/exolog/$transfer_user $tr_c2/exolog\
184
 fi\
184
  fi\
185
 cd $tr_c1\
185
  cd $tr_c1\
186
 rm -f noscore/$transfer_user score/$transfer_user score/$transfer_user.* 2>/dev/null
186
  rm -f noscore/$transfer_user score/$transfer_user score/$transfer_user.* 2>/dev/null
187
 
-