Rev 10132 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4626 | obado | 1 | # GetExamScores |
2 | # Donne les notes de l'ensemble des utilisateurs pour l'examen $qexam |
||
3 | |||
4 | #Pour commencer, on verifie la classe |
||
5 | !read scripts/check.class |
||
6 | !if $error!=$empty |
||
7 | !exit |
||
8 | !endif |
||
9 | |||
10 | #puis l'examen |
||
11 | type=exams |
||
12 | !read scripts/check.proc |
||
13 | !if $error!=$empty |
||
14 | !exit |
||
15 | !endif |
||
16 | |||
17 | exam_properties=!lines2items $qproperties\ |
||
18 | |||
19 | exam_status=!item 1 of $exam_properties |
||
4640 | obado | 20 | #Status : 0-inactif 1-actif 2-perime 3-perime+cache |
21 | !if $exam_status<1 or $exam_status>3 |
||
4626 | obado | 22 | error=Exam #$qexam must be active |
23 | !exit |
||
24 | !endif |
||
25 | |||
26 | nbexams=!recordcnt wimshome/log/classes/$qclass/exams/.exams |
||
27 | |||
28 | active_index=0 |
||
29 | nb_active=0 |
||
30 | |||
31 | !for i=1 to $nbexams |
||
32 | !reset exam_properties,status |
||
9676 | obado | 33 | |
4626 | obado | 34 | exam_properties=!record $i of wimshome/log/classes/$qclass/exams/.exams |
35 | status=!line 1 of $exam_properties |
||
36 | |||
37 | !if $status>=1 and $status <=2 |
||
38 | !advance nb_active |
||
39 | !endif |
||
9676 | obado | 40 | |
4626 | obado | 41 | !if $qexam=$i |
42 | active_index=$nb_active |
||
43 | !endif |
||
44 | !next i |
||
45 | |||
46 | class_superclass=!defof class_superclass in $classdeffile |
||
47 | #un utilisateur se trouve toujours dans la superclasse si elle existe |
||
48 | !if $class_superclass != $empty |
||
49 | users_dir = wimshome/log/classes/$class_superclass/.users |
||
50 | !else |
||
51 | users_dir = wimshome/log/classes/$qclass/.users |
||
52 | !endif |
||
53 | |||
54 | !read adm/class/mkuserlist $qclass |
||
10132 | bpr | 55 | !read adm/class/stat |
4626 | obado | 56 | |
57 | usercnt=!recordcnt wimshome/log/classes/$qclass/.userlist |
||
58 | !if $usercnt=0 |
||
59 | error=There's no user in this class |
||
60 | !exit |
||
61 | !endif |
||
62 | |||
63 | real_usercnt=0 |
||
64 | max_score=0 |
||
65 | mean_score=0 |
||
66 | |||
67 | !for u=1 to $usercnt |
||
68 | l=!record $u of wimshome/log/classes/$qclass/.userlist |
||
69 | quser=!item 3 of $l |
||
9677 | obado | 70 | lastname=!item 1 of $l |
71 | firstname=!item 2 of $l |
||
4626 | obado | 72 | !defread $users_dir/$quser |
73 | |||
74 | examscore=!examscore user=$quser class=$qclass |
||
75 | ##format du "examscore" : |
||
76 | #line 1 : exam1_scoremax exam2_scoremax ... |
||
77 | #line 2 : attempts_max, attempts, 1 ??? (exam 1) |
||
78 | #line n : attempts_max, attempts, 1 ??? (exam n-1) |
||
9676 | obado | 79 | |
4626 | obado | 80 | exam_score=!line 1 of $examscore |
81 | exam_score=!word $qexam of $exam_score |
||
82 | !if $exam_score>$max_score |
||
83 | max_score=$exam_score |
||
84 | !endif |
||
9676 | obado | 85 | |
4626 | obado | 86 | exam_attempts=!line $[$qexam+1] of $examscore |
87 | exam_attempts=!word 2 of $exam_attempts |
||
9676 | obado | 88 | |
4626 | obado | 89 | !if $exam_attempts > 0 |
90 | !advance real_usercnt |
||
91 | mean_score = $[$mean_score + $exam_score] |
||
9627 | obado | 92 | new_line = "id":"$quser", "first_name":"$firstname", "last_name":"$lastname", "score":$exam_score , "attempts" : $exam_attempts |
4626 | obado | 93 | data_scores = !append line $new_line to $data_scores |
94 | !endif |
||
95 | |||
96 | !next u |
||
97 | |||
98 | !if $mean_score>0 |
||
99 | mean_score = $[$mean_score / $real_usercnt] |
||
100 | !endif |
||
101 | |||
102 | scoremax=!record 0 of wimshome/log/classes/$qclass/sheets/.severity |
||
103 | scoremax=!word 1 of $scoremax |
||
104 | !default scoremax = 10 |
||
105 | |||
15837 | guerimand | 106 | weights = !getscoreweight class=$qclass user=$quser |