Rev 12981 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | |
2 | transfer_test=0 |
||
3 | !distribute words $wims_read_parm into transfer_user, transfer_cmd, transfer_other |
||
4594 | czzmrn | 4 | !if ($wims_supertype!=4 and $wims_supertype!=2) or $wims_user!=supervisor |
12981 | bpr | 5 | !exit |
20 | reyssat | 6 | !endif |
7 | tr_list= |
||
8 | tr_typename=!defof class_typename in wimshome/log/classes/$wims_class/.def |
||
9 | tr_l1=!defof user_participate in \ |
||
14336 | bpr | 10 | wimshome/log/classes/$wims_superclass/.users/$transfer_user |
12981 | bpr | 11 | !if $wims_supertype=4 |
12 | !if $tr_typename=course |
||
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 |
||
15 | !if $tr_class=$empty |
||
16 | tr_parent=!defof class_parent in wimshome/log/classes/$wims_class/.def |
||
17 | !if $tr_parent!=$empty and $tr_parent isitemof $tr_l1 |
||
18 | tr_class=$tr_parent |
||
19 | !endif |
||
20 | !else |
||
21 | tr_class=$wims_superclass/$tr_class |
||
22 | !endif |
||
23 | !if $tr_program!=$empty and $tr_class!=$empty |
||
24 | tr_l2=!record 0 of wimshome/log/classes/$tr_program/courses |
||
25 | tr_l3=!record 0 of wimshome/log/classes/$tr_program/icourses |
||
26 | tr_l2=!append line $tr_l3 to $tr_l2 |
||
27 | tr_l2=!column 1 of $tr_l2 |
||
28 | tr_l2=!nonempty items $tr_l2 |
||
29 | tr_l2=!makelist $wims_superclass/x for x in $tr_l2 |
||
30 | tr_l2=!listcomplement $wims_class in $tr_l2 |
||
31 | tr_list= |
||
32 | !for c_ in $tr_l2 |
||
33 | tr_test1=!defof user_class in \ |
||
14336 | bpr | 34 | wimshome/log/classes/$c_/.users/$transfer_user |
12981 | bpr | 35 | tr_test2=!defof sharing_exam in wimshome/log/classes/$c_/neighbors |
36 | !if $wims_superclass/$tr_test1=$tr_class or \ |
||
14336 | bpr | 37 | $tr_test2=$tr_program |
12981 | bpr | 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 |
||
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 |
||
56 | !next c_ |
||
20 | reyssat | 57 | !endif |
58 | !else |
||
12981 | bpr | 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 |
||
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 |
||
70 | !! same class |
||
71 | !if $tr_sharing!=$empty |
||
72 | tr_list=$tr_sharing |
||
73 | !! altri candidati |
||
74 | tr_l2=!defof sharable_exam in wimshome/log/classes/$tr_sharing/neighbors |
||
75 | tr_l2=!listcomplement $wims_class in $tr_l2 |
||
76 | !! controllo che queste effettivamente siano in sharing |
||
77 | !for c_ in $tr_l2 |
||
78 | tr_test=!defof sharing_exam in wimshome/log/classes/$c_/neighbors |
||
79 | !if $tr_test=$tr_sharing |
||
80 | tr_list=!append item $c_ to $tr_list |
||
81 | !endif |
||
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 |
||
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 |
||
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 |
||
4594 | czzmrn | 102 | !endif |
103 | !endif |
||
104 | !endif |
||
20 | reyssat | 105 | |
106 | !if $tr_list!=$empty |
||
12981 | bpr | 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\ |
||
14336 | bpr | 112 | find $tr_l1 -name $transfer_user -o -name $transfer_user.exam | sed 's!/score/.*$$!!' |
12981 | bpr | 113 | tr_noscore=!sh cd $wims_home/log/classes\ |
14336 | bpr | 114 | find $tr_l2 -name $transfer_user | sed 's!/noscore/.*$$!!' |
12981 | bpr | 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 |
||
20 | reyssat | 119 | !endif |
120 | |||
121 | transfer_test=!itemcnt $tr_list |
||
122 | !if $transfer_test<1 or $transfer_cmd=test or\ |
||
14336 | bpr | 123 | $transfer_other notitemof $tr_list |
12981 | bpr | 124 | !exit |
20 | reyssat | 125 | !endif |
126 | |||
4594 | czzmrn | 127 | !if $wims_supertype=4 |
12981 | bpr | 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 |
||
20 | reyssat | 148 | !endif |
149 | !endif |
||
150 | |||
4594 | czzmrn | 151 | !if $wims_supertype=2 and $tr_typename=class |
12981 | bpr | 152 | !if $transfer_other isitemof $tr_list |
153 | tr_this=$wims_class |
||
154 | !endif |
||
4594 | czzmrn | 155 | !endif |
156 | |||
20 | reyssat | 157 | tr_c1=log/classes/$transfer_other |
158 | tr_c2=log/classes/$tr_this |
||
159 | !if $transfer_cmd=replace |
||
12981 | bpr | 160 | mline=cp $tr_c1/score/$transfer_user $tr_c2/score |
20 | reyssat | 161 | !else |
12981 | bpr | 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 |
||
20 | reyssat | 164 | !endif |
165 | |||
166 | !sh cd $wims_home\ |
||
167 | if [ -f $tr_c1/score/$transfer_user ]; then\ |
||
12981 | bpr | 168 | $mline\ |
169 | fi\ |
||
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\ |
||
172 | sort <$wims_sesdir/transfer >$tr_c2/noscore/$transfer_user\ |
||
173 | fi\ |
||
174 | if [ -f $tr_c1/score/$transfer_user.exam ]; then\ |
||
175 | cat $tr_c1/score/$transfer_user.exam >>$tr_c2/score/$transfer_user.exam\ |
||
176 | fi\ |
||
177 | if [ -d $tr_c1/examlog/$transfer_user ]; then\ |
||
178 | mkdir -p $tr_c2/examlog\ |
||
179 | mv -f $tr_c1/examlog/$transfer_user $tr_c2/examlog\ |
||
180 | fi\ |
||
181 | if [ -d $tr_c1/exolog/$transfer_user ]; then\ |
||
182 | mkdir -p $tr_c2/exolog\ |
||
183 | mv -f $tr_c1/exolog/$transfer_user $tr_c2/exolog\ |
||
184 | fi\ |
||
185 | cd $tr_c1\ |
||
186 | rm -f noscore/$transfer_user score/$transfer_user score/$transfer_user.* 2>/dev/null |