d0f04cfac2e810a22b2621bd8999ccbffc43cfcd
1 //TODO: compute grades after exam (in teacher's view)
6 evaluationArray: evaluationArray
,
12 group: 1, //for detailed grades tables
13 grades: { }, //computed
20 gradeSettings: function() {
21 $("#gradeSettings").modal("open");
22 Materialize
.updateTextFields(); //total points field in grade settings overlap
24 download: function() {
25 // Download (all) grades as a CSV file
27 this.studentList(0).forEach( s
=> {
30 if (!!this.grades
[s
.number
])
32 Object
.keys(this.grades
[s
.number
]).forEach( evaluationName
=> {
33 s
[evaluationName
] = this.grades
[s
.number
][evaluationName
];
34 if (_
.isNumeric(s
[evaluationName
]) && !isNaN(s
[evaluationName
]))
36 finalGrade
+= s
[evaluationName
];
40 finalGrade
/= gradesCount
;
41 s
["final"] = finalGrade
; //TODO: forbid "final" as evaluation name
44 data
.push(s
); //number,name,group,assessName1...assessNameN,final
46 let csv
= Papa
.unparse(data
, {
50 let downloadAnchor
= $("#download");
51 downloadAnchor
.attr("download", this.course
.code
+ "_results.csv");
52 downloadAnchor
.attr("href", "data:text/plain;charset=utf-8," + encodeURIComponent(csv
));
53 this.$refs
.download
.click()
54 //downloadAnchor.click(); //fails
56 showDetails: function(group
) {
58 $("#detailedGrades").modal("open");
60 groupList: function() {
62 this.course
.students
.forEach( s
=> {
66 return _
.range(1,maxGrp
+1);
68 grade: function(evaluationIndex
, studentNumber
) {
69 if (!this.grades
[evaluationIndex
] || !this.grades
[evaluationIndex
][studentNumber
])
70 return ""; //no grade yet
71 return this.grades
[evaluationIndex
][studentNumber
];
73 groupId: function(group
, prefix
) {
74 return (prefix
|| "") + "group" + group
;
76 togglePresence: function(number
, index
) {
78 // TODO: if no grade (thus automatic 0), toggle "exempt" state on student for current exam
79 // --> automatic update of grades view (just a few number to change)
81 computeGrades: function() {
83 // TODO: compute all grades using settings (points, coefficients, bonus/malus...).
84 // If some questions with free answers (open), display answers and ask teacher action.
85 // TODO: need a setting for that too (by student, by exercice, by question)