mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:59:30 +00:00
Implemented Student.getTestResults
This commit is contained in:
@@ -8,12 +8,26 @@ class Student extends User {
|
||||
super(conn, id, 'student');
|
||||
}
|
||||
|
||||
get classes() {
|
||||
async getTestResults() {
|
||||
const sql = `
|
||||
select
|
||||
testResultId
|
||||
from
|
||||
testResult
|
||||
where
|
||||
studentId = ?
|
||||
order by
|
||||
time desc;
|
||||
`;
|
||||
|
||||
}
|
||||
|
||||
get parents() {
|
||||
const records = await this._conn.runQuery(sql, [ this.id ]);
|
||||
|
||||
return Promise.all(records.map(r => {
|
||||
return new (require('./TestResult'))(
|
||||
this._conn,
|
||||
r.testResultId
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
static async createStudent(conn, fname, oname, lname, email, password) {
|
||||
|
||||
Reference in New Issue
Block a user