Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions database/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ module.exports = {
},
getOneStudentByID: (id) => {
return knex('student AS s')
.select('s.*', 'gt.name AS grade_name')
.select(knex.raw('s.*, gt.name AS grade_name, min(timestamp) as initial_communication'))
.leftJoin('grade_type AS gt', 'gt.id', 'grade_type_id')
.where('s.id', id);
.leftJoin('communication as comm', 'comm.student_id', 's.id' )
.where('s.id', id)
.groupBy('s.id', 'gt.name')
},
getStakeholdersByStudentID: (id) => {
return knex('student_stakeholder AS ss')
Expand Down