* password: monitoring password hash
* students: array of
* number: student number
- * forename: varchar
* name: varchar
* group: integer
*/
* _id: BSON id
* ** Strings, identification informations:
* email
- * forename
* name
* initials : computed, Benjamin Auder --> ba ...etc
* loginToken: {
{
create: function(newUser, callback)
{
- // Determine initials from forename+name
- let forenameParts = newUser.forename.split(/[ -]+/);
+ // Determine initials from name parts
let nameParts = newUser.name.split(/[ -]+/);
- let initials =
- forenameParts.map( n => { return n.charAt(0).toLowerCase(); }).join("") +
- nameParts.map( n => { return n.charAt(0).toLowerCase(); }).join("");
+ let initials = nameParts.map( n => { return n.charAt(0).toLowerCase(); }).join("");
// First retrieve all users with similar prefix initials
UserEntity.getInitialsByPrefix(initials, (err,userArray) => {
if (!!userArray && userArray.length == 1)
return this.course.students
.filter( s => { return group==0 || s.group == group; })
.map( s => { return Object.assign({}, s); }) //not altering initial array
- .sort( (a,b) => {
- let res = a.name.localeCompare(b.name);
- if (res == 0)
- res += a.forename.localeCompare(b.forename);
- return res;
- });
+ .sort( (a,b) => { return a.name.localeCompare(b.name); })
},
// STUDENTS:
uploadTrigger: function() {
s["final"] = finalGrade; //TODO: forbid "final" as assessment name
});
}
- data.push(s); //number,forename,name,group,assessName1...assessNameN,final
+ data.push(s); //number,name,group,assessName1...assessNameN,final
});
let csv = Papa.unparse(data, {
quotes: true,
data: {
messages: messages,
user: {
- forename: "",
name: "",
email: "",
},
}
let error = Validator.checkObject({email: this.user.email}, "User");
if (!error && this.stage == "register")
- error = Validator.checkObject({forename: this.user.forename, name: this.user.name}, "User");
+ error = Validator.checkObject({name: this.user.name}, "User");
let $dialog = $("#dialog");
show($dialog);
setTimeout(() => {hide($dialog);}, 3000);
data:
{
email: encodeURIComponent(this.user.email),
- forename: encodeURIComponent(this.user.forename), //may be unused
name: encodeURIComponent(this.user.name), //may be unused
},
dataType: "json",
success: res => {
if (!res.errmsg)
{
- this.user["forename"] = "";
this.user["name"] = "";
this.user["email"] = "";
showMsg($dialog, "info", infos[this.stage]);
return this.students
.filter( s => { return group==0 || s.group == group; })
.map( s => { return Object.assign({}, s); }) //not altering initial array
- .sort( (a,b) => {
- let res = a.name.localeCompare(b.name);
- if (res == 0)
- res += a.forename.localeCompare(b.forename);
- return res;
- });
+ .sort( (a,b) => { return a.name.localeCompare(b.name); });
},
groupList: function() {
let maxGrp = 1;
Validator.User = {
"_id": "bson",
"email": "email",
- "forename": "name",
"name": "name",
"initials": "unchecked", //not a user input
"loginToken": "unchecked",
Validator.Student = {
"number": "code",
- "forename": "name",
"name": "name",
"group": "positiveInteger",
};
router.get('/register', access.ajax, access.unlogged, (req,res) => {
let email = decodeURIComponent(req.query.email);
- let forename = decodeURIComponent(req.query.forename);
let name = decodeURIComponent(req.query.name);
const newUser = {
email: email,
name: name,
- forename: forename,
};
let error = validator(newUser, "User");
if (error.length > 0)
-forename,name
-William,Plaisance
-Rosamonde,Dupuy
-Fabienne,Aubin
-Grégoire,Léveillé
-Fantina,Quinn
-Amitee,Morneau
-William,Lespérance
-Dreux,Vadeboncoeur
-Brigliador,Cadieux
-Grosvenor,Provencher
-Landers,Devost
-Joy,Laprise
-Dielle,Séguin
-Sidney,DeGrasse
-Jules,Gaillou
-Archaimbau,Bizier
-Dexter,Aucoin
-Searlas,Rivière
-Germain,Charpie
-Honore,Charlesbois
-Georges,LaCaille
-Anne,Ruest
-Searlas,Rochefort
-Ferrau,Adler
-Aimée,Asselin
-Delit,Cyr
-Noël,Babin
+name
+PLAISANCE William
+DUPUY Rosamonde
+AUBIN Fabienne
+LÉVEILLÉ Grégoire
+QUINN Fantina
+MORNEAU Amitee
+LESPÉRANCE William
+VADEBONCOEUR Dreux
+CADIEUX Brigliador
+PROVENCHER Grosvenor
+DEVOST Landers
+LAPRISE Joy
+SÉGUIN Dielle
+DEGRASSE Sidney
+GAILLOU Jules
+BIZIER Archaimbau
+AUCOIN Dexter
+RIVIÈRE Searlas
+CHARPIE Germain
+CHARLESBOIS Honore
+LACAILLE Georges
+RUEST Anne
+ROCHEFORT Searlas
+ADLER Ferrau
+ASSELIN Aimée
+CYR Delit
+BABIN Noël
#stage1(v-show="stage==1")
.card
if assessment.mode != "open"
- .input-field.inline.on-left
- label(for="forename") Forename
- input#forename(type="text" v-model="student.forename" disabled)
.input-field.inline
label(for="name") Name
input#name(type="text" v-model="student.name" disabled)
tbody
tr.grade(v-for="student in studentList(group)")
td {{ student.number }}
- td(v-for="(assessment,i) in assessmentArray" @click="togglePresence(student.number,i)") {{ grade(i,student.number) }}
+ td(v-for="(assessment,i) in assessmentArray" @click="togglePresence(student.number,i)")
+ {{ grade(i,student.number) }}
.modal-footer
.center-align
a.modal-action.modal-close.waves-effect.waves-light.btn-flat(href="#!") Close
thead
tr
th Number
- th Forename
th Name
th Group
tbody
tr.student(v-for="student in studentList(0)")
td {{ student.number }}
- td {{ student.forename }}
td {{ student.name }}
td {{ student.group }}
h4.title(@click="toggleDisplay('assessments')") Assessments
if teacher
.center-align
a.on-left.waves-effect.waves-light.btn.modal-trigger(href="#newAssessment") New assessment
- input#password(type="password" v-model="monitorPwd" @keyup.enter="setPassword" placeholder="Password" title="Monitoring password")
+ input#password(type="password" v-model="monitorPwd" @keyup.enter="setPassword"
+ placeholder="Password" title="Monitoring password")
table
thead
tr
th #Questions
th Time
tbody
- tr.assessment(v-for="(assessment,i) in assessmentArray" @click.left="actionAssessment(i)" @contextmenu.prevent="deleteAssessment(assessment)")
+ tr.assessment(v-for="(assessment,i) in assessmentArray" v-if="assessment.active"
+ @click.left="actionAssessment(i)" @contextmenu.prevent="deleteAssessment(assessment)")
td {{ assessment.name }}
td {{ assessment.mode }}
td {{ assessment.questions.reduce( (a,b) => { return b.active ? a+1 : a; }, 0) }}
thead
tr
th Number
- th Forename
th Name
th Final
tbody
tr.grade(v-for="student in studentList(group)")
td {{ student.number }}
- td {{ student.forename }}
td {{ student.name }}
td grade...
//td {{ grades[student.number].final }}
table(:id="groupId(group)" v-for="group in [0].concat(groupList())")
thead
tr
- th Forename
th Name
th(v-for="(q,i) in assessment.questions") Q.{{ (i+1) }}
tbody
tr.assessment(v-for="s in studentList(group)")
- td {{ s.forename }}
td {{ s.name }}
td(v-for="(q,i) in assessment.questions" :style="{background-color: getColor(number,i)}" @click="seeDetails(number,i)")
h4.title(@click="toggleDisplay('assessment')") Assessment
thead
tr
th Name
- th Forename
tbody
each user in userArray
tr.teacher(onClick="document.location.href='/" + user.initials+ "'")
td= user.name
- td= user.forename
.input-field
input#email.validate(type="email", ref="userEmail", v-model="user.email", required)
label(for="email") Email
- .input-field(v-show="stage=='register'")
- input#forename.validate(type="text", v-model="user.forename", :required="stage=='register'")
- label(for="forename") Forename
.input-field(v-show="stage=='register'")
input#name.validate(type="text", v-model="user.name", :required="stage=='register'")
label(for="name") Name
table(:id="groupId(group)" v-for="group in [0].concat(groupList())")
thead
tr
- th Forename
th Name
th(v-for="(q,i) in assessment.questions") Q.{{ (i+1) }}
tbody
tr.assessment(v-for="s in studentList(group)")
- td {{ s.forename }}
td {{ s.name }}
td(v-for="(q,i) in assessment.questions" :style="{backgroundColor: getColor(s.number,i)}" @click="seeDetails(s.number,i)")
h4.title(@click="toggleDisplay('assessment')") Assessment