Skip to content

Commit

Permalink
feat: pass external attempt id to provider js (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharis278 authored Oct 24, 2022
1 parent 35352e6 commit 2a0f403
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/data/messages/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function workerTimeoutPromise(timeoutMilliseconds) {
}

export function workerPromiseForEventNames(eventNames, workerUrl) {
return (timeout) => {
return (timeout, attemptExternalId) => {
const proctoringBackendWorker = createWorker(workerUrl);
return new Promise((resolve, reject) => {
const responseHandler = (e) => {
Expand All @@ -29,7 +29,7 @@ export function workerPromiseForEventNames(eventNames, workerUrl) {
}
};
proctoringBackendWorker.addEventListener('message', responseHandler);
proctoringBackendWorker.postMessage({ type: eventNames.promptEventName, timeout });
proctoringBackendWorker.postMessage({ type: eventNames.promptEventName, timeout, attemptExternalId });
});
};
}
Expand Down
1 change: 1 addition & 0 deletions src/data/slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const examSlice = createSlice({
desktop_application_js_url: '',
ping_interval: null,
attempt_code: '',
external_id: '',
},
type: '',
},
Expand Down
1 change: 1 addition & 0 deletions src/data/thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export function startProctoredExam() {
const startExamTimeoutMilliseconds = EXAM_START_TIMEOUT_MILLISECONDS;
workerPromiseForEventNames(actionToMessageTypesMap.start, exam.attempt.desktop_application_js_url)(
startExamTimeoutMilliseconds,
attempt.external_id,
).then(() => updateAttemptAfter(
exam.course_id, exam.content_id, continueAttempt(attempt.attempt_id),
)(dispatch))
Expand Down

0 comments on commit 2a0f403

Please sign in to comment.