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