Skip to content

Commit c24cdca

Browse files
committed
Resolve merge conflict.
1 parent c870039 commit c24cdca

File tree

12 files changed

+435
-957
lines changed

12 files changed

+435
-957
lines changed

CollaborationService/client-side/client.js

Lines changed: 0 additions & 152 deletions
This file was deleted.

CollaborationService/client-side/index.html

Lines changed: 0 additions & 32 deletions
This file was deleted.

CollaborationService/database/collaborativeInputDb.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ const updateCollaborativeInput = async (sessionId, codes) => {
144144
}
145145
};
146146

147+
const updateInitTime = async (sessionId, initTime) => {
148+
try {
149+
const collaborativeInput = await CollaborativeInput.findOne({
150+
sessionId: sessionId,
151+
});
152+
153+
collaborativeInput.initTime = initTime;
154+
155+
await collaborativeInput.save();
156+
157+
console.log(`Successfully updated:`, collaborativeInput);
158+
} catch (error) {
159+
console.log(`Failed to update init time for ${sessionId}`);
160+
}
161+
}
162+
147163
const updateCollaborativeLanguage = async (sessionId, language) => {
148164
try {
149165
let collaborativeInput = await CollaborativeInput.findOne({
@@ -212,6 +228,7 @@ module.exports = {
212228
getCollaborativeInput,
213229
getCollaborativeInputByLine,
214230
initCollaborativeCode,
231+
updateInitTime,
215232
updateCollaborativeLineInput,
216233
updateCollaborativeInput,
217234
updateCollaborativeLanguage,

CollaborationService/services/collaborationService.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const {
22
initCollaborativeCode,
3+
updateInitTime,
34
updateCollaborativeInput,
45
updateCollaborativeLineInput,
56
updateCollaborativeLanguage,
@@ -13,6 +14,7 @@ let initSession = new Map();
1314
let sessionTracker = new Map();
1415

1516
const startCollaboration = async (socket, io) => {
17+
console.log(`Starting collaboration for socket ${socket.id}`);
1618
const collaborationSessionExist = await verifyCurrentSession(
1719
socket.handshake.query.sessionId,
1820
socket.handshake.query.userId
@@ -62,6 +64,7 @@ const startCollaboration = async (socket, io) => {
6264
initSession.get(sessionId)[0],
6365
initSession.get(sessionId)[1]
6466
);
67+
await updateInitTime(sessionId, initSession.get(sessionId)[0]);
6568
timerDelay = 1000;
6669
} else {
6770
console.log(`init session ${sessionId}`);

CollaborationService/test/collabTestSchema.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)