Skip to content

Commit

Permalink
Update consumer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
davbrican committed Nov 17, 2021
1 parent 9c829d0 commit fa5b93d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ async function executeSession(sessionName, io) {
testLanguage: testLanguage,
}
});

io.to(participant1.socketId).emit("customAlert", {
data: {
message: "New exercise beggins"
}
});
}
}
if ((exercise.type == "PAIR" && participant2.visitedPExercises.length < listExercises.length) || (exercise.type == "INDIVIDUAL" && participant2.visitedIExercises.length < listExercises.length)) {
Expand All @@ -218,8 +224,25 @@ async function executeSession(sessionName, io) {
testLanguage: testLanguage,
}
});

io.to(participant2.socketId).emit("customAlert", {
data: {
message: "New exercise beggins"
}
});
}
}
/*
else {
io.to(participant1.socketId).emit("customAlert", {
data: {
message: "There are no more exercises left"
}
});
}
*/


if (listExercises[num2Send].type == "PAIR") {
participant1.visitedPExercises.push(num2Send);
participant1.save();
Expand Down Expand Up @@ -287,7 +310,6 @@ async function executeSession(sessionName, io) {
lastSessionEvent.set(sessionName, event);
Logger.dbg("executeSession - lastSessionEvent saved", event[0]);


timer = tests[testNumber].time; //Resets the timer
session.exerciseCounter = 0;
Logger.dbg("executeSession - testCounter: " + session.testCounter + " of " + numTests + " , exerciseCounter: " + session.exerciseCounter + " of " + maxExercises);
Expand Down Expand Up @@ -332,6 +354,17 @@ async function executeSession(sessionName, io) {
testLanguage: testLanguage,
}
});

io.to(participant1.socketId).emit("customAlert", {
data: {
message: "New exercise beggins"
}
});
io.to(participant2.socketId).emit("customAlert", {
data: {
message: "New exercise beggins"
}
});


if (exercise.type == "PAIR") {
Expand Down

0 comments on commit fa5b93d

Please sign in to comment.