added sort values to Student.tries

parent 1e1e63f3
Showing with 3 additions and 0 deletions
...@@ -430,6 +430,7 @@ module.exports = { ...@@ -430,6 +430,7 @@ module.exports = {
function (instruction, next_ins) { function (instruction, next_ins) {
Instruction.findOne(instruction.id) Instruction.findOne(instruction.id)
.sort('begin DESC')
.populate('workingSessions') .populate('workingSessions')
.then((populated_ins) => { .then((populated_ins) => {
if (!populated_ins || !populated_ins.workingSessions || populated_ins.workingSessions.length == 0) if (!populated_ins || !populated_ins.workingSessions || populated_ins.workingSessions.length == 0)
...@@ -441,6 +442,7 @@ module.exports = { ...@@ -441,6 +442,7 @@ module.exports = {
function(ws, next_ws) { function(ws, next_ws) {
WorkingSession.findOne(ws.id) WorkingSession.findOne(ws.id)
.sort('begin DESC')
.populate('tries') .populate('tries')
.then((populated_ws) => { .then((populated_ws) => {
if (!populated_ws || !populated_ws.tries || populated_ws.tries.length == 0) if (!populated_ws || !populated_ws.tries || populated_ws.tries.length == 0)
...@@ -452,6 +454,7 @@ module.exports = { ...@@ -452,6 +454,7 @@ module.exports = {
function(t, next_t) { function(t, next_t) {
Try.findOne(t.id) Try.findOne(t.id)
.sort('begin DESC')
.populate('actions') .populate('actions')
.then((populated_try) => { .then((populated_try) => {
if (!populated_try || !populated_try.actions || populated_try.actions.length == 0) if (!populated_try || !populated_try.actions || populated_try.actions.length == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment