Big Update
This commit is contained in:
28
classes/parsers/Teacher.js
Normal file
28
classes/parsers/Teacher.js
Normal file
@@ -0,0 +1,28 @@
|
||||
class Teacher {
|
||||
/**
|
||||
* Creates a Instance of Teacher
|
||||
*
|
||||
* @param {String} teacher - Code for the teacher.
|
||||
* @param {Object} teacherList - Object of teachers.
|
||||
*/
|
||||
constructor(teacher, teacherList) {
|
||||
/** @returns {String} Teacher's code */
|
||||
this.code = teacher;
|
||||
|
||||
teacher = teacherList && teacherList[this.code] ? teacherList[this.code] : {};
|
||||
|
||||
/** @returns {String} First name(s) of the teacher. If unset the teacher's code. */
|
||||
this.firstName = teacher.firstName ?? this.code;
|
||||
/** @returns {String} Last name of the teacher. If unset the teacher's code. */
|
||||
this.lastName = teacher.lastName ?? this.code;
|
||||
|
||||
let name = [];
|
||||
if(teacher.firstName) name.push(teacher.firstName);
|
||||
if(teacher.lastName) name.push(teacher.lastName);
|
||||
|
||||
/** @returns {String} Full name of the teacher. If unset the teacher's code. */
|
||||
this.fullName = name.join(" ") || this.code;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Teacher
|
||||
Reference in New Issue
Block a user