Skip to content

Commit aecfcdb

Browse files
Log: Replace development log with production log when thre is an unavailable page redirect.
Add interview id in the log
1 parent c4f9a63 commit aecfcdb

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/evolution-backend/src/api/survey.participant.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default (authorizationMiddleware, loggingMiddleware: InterviewLoggingMidd
8585

8686
// Check if interview is frozen, if so, do not allow access
8787
if (interview?.is_frozen) {
88-
console.log('activeSurvey: Interview is frozen');
88+
console.log(`activeSurvey: Interview is frozen for interview id ${interview?.id}`);
8989
return res
9090
.status(403)
9191
.json({ status: 'forbidden', interview: null, error: 'interview cannot be accessed' });

packages/evolution-backend/src/api/survey.user.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default (authorizationMiddleware, loggingMiddleware: InterviewLoggingMidd
4040
// Get the current interview with uuid
4141
const interview = await Interviews.getInterviewByUuid(req.params.interviewId);
4242
if (interview?.is_frozen) {
43-
console.log('activeSurvey: Interview is frozen');
43+
console.log(`activeSurvey: Interview is frozen for interview id ${interview?.id}`);
4444
return res
4545
.status(403)
4646
.json({ status: 'forbidden', interview: null, error: 'interview cannot be accessed' });

packages/evolution-frontend/src/actions/Survey.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ export const startSetInterview = (
794794
}
795795
} else if (response.status === 403) {
796796
// The interview is frozen, redirect to the survey unavailable page
797-
surveyHelper.devLog('Redirect to unavailable page: frozen interview');
797+
// Note: We want to monitor how often this happens.
798+
console.log('Redirect to unavailable page: interview cannot be accessed for respondent');
798799
if (navigate) {
799800
navigate('/unavailable'); // User goes to 'unavailable' page
800801
} else {

packages/evolution-frontend/src/actions/SurveyAdmin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ export const startSetSurveyCorrectedInterview = (
246246
}
247247
} else if (response.status === 403) {
248248
// The interview is frozen, redirect to the survey unavailable page
249-
surveyHelper.devLog('Redirect to unavailable page: frozen interview');
249+
// Note: We want to monitor how often this happens.
250+
console.log('Redirect to unavailable page: interview cannot be accessed for admin');
250251
window.location.href = '/unavailable'; // User goes to 'unavailable' page
251252
}
252253
} catch (err) {

0 commit comments

Comments
 (0)