Rev 4594 | Go to most recent revision | Details | 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 |
||
4 | !if $wims_supertype!=4 or $wims_user!=supervisor |
||
5 | !exit |
||
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 \ |
||
10 | wimshome/log/classes/$wims_superclass/.users/$transfer_user |
||
11 | !if $tr_typename=course |
||
12 | tr_program=!defof sharing_exam in wimshome/log/classes/$wims_class/neighbors |
||
13 | tr_class=!defof user_class in wimshome/log/classes/$wims_class/.users/$transfer_user |
||
14 | !if $tr_class=$empty |
||
15 | tr_parent=!defof class_parent in wimshome/log/classes/$wims_class/.def |
||
16 | !if $tr_parent!=$empty and $tr_parent isitemof $tr_l1 |
||
17 | tr_class=$tr_parent |
||
18 | !endif |
||
19 | !else |
||
20 | tr_class=$wims_superclass/$tr_class |
||
21 | !endif |
||
22 | !if $tr_program!=$empty and $tr_class!=$empty |
||
23 | tr_l2=!record 0 of wimshome/log/classes/$tr_program/courses |
||
24 | tr_l3=!record 0 of wimshome/log/classes/$tr_program/icourses |
||
25 | tr_l2=!append line $tr_l3 to $tr_l2 |
||
26 | tr_l2=!column 1 of $tr_l2 |
||
27 | tr_l2=!nonempty items $tr_l2 |
||
28 | tr_l2=!makelist $wims_superclass/x for x in $tr_l2 |
||
29 | tr_l2=!listcomplement $wims_class in $tr_l2 |
||
30 | tr_list= |
||
31 | !for c_ in $tr_l2 |
||
32 | tr_test1=!defof user_class in \ |
||
33 | wimshome/log/classes/$c_/.users/$transfer_user |
||
34 | tr_test2=!defof sharing_exam in wimshome/log/classes/$c_/neighbors |
||
35 | !if $wims_superclass/$tr_test1=$tr_class or \ |
||
36 | $tr_test2=$tr_program |
||
37 | tr_list=!append item $c_ to $tr_list |
||
38 | !endif |
||
39 | !next c_ |
||
40 | !endif |
||
41 | !else |
||
42 | !if $wims_class notitemof $tr_l1 |
||
43 | !exit |
||
44 | !endif |
||
45 | tr_l1=!listcomplement $wims_class in $tr_l1 |
||
46 | !for c_ in $tr_l1 |
||
47 | tr_l2=!defof class_ocourses in wimshome/log/classes/$c_/.def |
||
48 | tr_l3=!defof user_courses in wimshome/log/classes/$c_/.users/$transfer_user |
||
49 | tr_l2=!append item $tr_l3 to $tr_l2 |
||
50 | tr_l2=!nonempty items $tr_l2 |
||
51 | !if $tr_l2!=$empty |
||
52 | tr_l2=!makelist $wims_superclass/x for x in $tr_l2 |
||
53 | tr_list=!append item $tr_l2 to $tr_list |
||
54 | !endif |
||
55 | !next c_ |
||
56 | !endif |
||
57 | |||
58 | !if $tr_list!=$empty |
||
59 | tr_l1=!makelist x/score for x in $tr_list |
||
60 | tr_l2=!makelist x/noscore for x in $tr_list |
||
61 | tr_l1=!items2words $tr_l1 |
||
62 | tr_l2=!items2words $tr_l2 |
||
63 | tr_score=!sh cd $wims_home/log/classes\ |
||
64 | find $tr_l1 -name $transfer_user -o -name $transfer_user.exam | sed 's!/score/.*$$!!' |
||
65 | tr_noscore=!sh cd $wims_home/log/classes\ |
||
66 | find $tr_l2 -name $transfer_user | sed 's!/noscore/.*$$!!' |
||
67 | tr_score=!words2items $tr_score |
||
68 | tr_noscore=!words2items $tr_noscore |
||
69 | tr_list=!listunion $tr_score and $tr_noscore |
||
70 | tr_list=!nonempty items $tr_list |
||
71 | !endif |
||
72 | |||
73 | transfer_test=!itemcnt $tr_list |
||
74 | !if $transfer_test<1 or $transfer_cmd=test or\ |
||
75 | $transfer_other notitemof $tr_list |
||
76 | !exit |
||
77 | !endif |
||
78 | |||
79 | !default tr_program=!defof sharing_exam in wimshome/log/classes/$transfer_other/neighbors |
||
80 | !if $tr_typename!=course |
||
81 | tr_l1=!defof class_ocourses in wimshome/log/classes/$wims_class/.def |
||
82 | tr_l2=!defof user_courses in wimshome/log/classes/$wims_class/.users/$transfer_user |
||
83 | tr_l1=!append item $tr_l2 to $tr_l1 |
||
84 | tr_l1=!nonempty items $tr_l1 |
||
85 | tr_l1=!makelist $wims_superclass/x for x in $tr_l1 |
||
86 | !for c in $tr_l1 |
||
87 | tr_pr=!defof sharing_exam in wimshome/log/classes/$c/neighbors |
||
88 | !if $tr_pr=$tr_program |
||
89 | tr_this=$c |
||
90 | !break |
||
91 | !endif |
||
92 | !next c |
||
93 | !if $tr_this=$empty |
||
94 | error=no_reccourse |
||
95 | !exit |
||
96 | !endif |
||
97 | !else |
||
98 | tr_this=$wims_class |
||
99 | !endif |
||
100 | |||
101 | tr_c1=log/classes/$transfer_other |
||
102 | tr_c2=log/classes/$tr_this |
||
103 | !if $transfer_cmd=replace |
||
104 | mline=cp $tr_c1/score/$transfer_user $tr_c2/score |
||
105 | !else |
||
106 | mline=cat $tr_c1/score/$transfer_user $tr_c2/score/$transfer_user 2>/dev/null >$wims_sesdir/transfer\ |
||
107 | sort <$wims_sesdir/transfer >$tr_c2/score/$transfer_user |
||
108 | !endif |
||
109 | |||
110 | !sh cd $wims_home\ |
||
111 | if [ -f $tr_c1/score/$transfer_user ]; then\ |
||
112 | $mline\ |
||
113 | fi\ |
||
114 | if [ -f $tr_c1/noscore/$transfer_user ]; then\ |
||
115 | cat $tr_c1/noscore/$transfer_user $tr_c2/noscore/$transfer_user 2>/dev/null >$wims_sesdir/transfer\ |
||
116 | sort <$wims_sesdir/transfer >$tr_c2/noscore/$transfer_user\ |
||
117 | fi\ |
||
118 | if [ -f $tr_c1/score/$transfer_user.exam ]; then\ |
||
119 | cat $tr_c1/score/$transfer_user.exam >>$tr_c2/score/$transfer_user.exam\ |
||
120 | fi\ |
||
121 | if [ -d $tr_c1/examlog/$transfer_user ]; then\ |
||
122 | mkdir -p $tr_c2/examlog\ |
||
123 | mv -f $tr_c1/examlog/$transfer_user $tr_c2/examlog\ |
||
124 | fi\ |
||
125 | if [ -d $tr_c1/exolog/$transfer_user ]; then\ |
||
126 | mkdir -p $tr_c2/exolog\ |
||
127 | mv -f $tr_c1/exolog/$transfer_user $tr_c2/exolog\ |
||
128 | fi\ |
||
129 | cd $tr_c1\ |
||
130 | rm -f noscore/$transfer_user score/$transfer_user score/$transfer_user.* 2>/dev/null |
||
131 |