Skip to content

Conversation

@jmgasper
Copy link
Collaborator

CORE-2300 / PM-2959

@jmgasper jmgasper requested a review from kkartunov as a code owner November 19, 2025 23:31
store.auth
</code>

of Redux store, or in the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The change from v3jwt to tcjwt in the authentication token lookup might affect the authentication flow. Ensure that tcjwt is the correct and intended token to use in all contexts where this code is executed.

};

const getSubmissionCreatedTime = (submission) => {
if (!submission) return undefined;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The function getSubmissionCreatedTime returns undefined if submission is falsy. Consider returning null instead to explicitly indicate the absence of a value, which is more semantically correct and can prevent potential issues when this function's output is used elsewhere.

case 'Time': {
valueA = new Date(a.submissionTime);
valueB = new Date(b.submissionTime);
valueA = new Date(getSubmissionCreatedTime(a));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
When creating a new Date object with getSubmissionCreatedTime, ensure that the returned value is a valid date string or timestamp. If getSubmissionCreatedTime returns undefined, new Date(undefined) will result in an invalid date object, which could lead to unexpected behavior.

const statusLabel = isAccepted ? 'Accepted' : 'In Queue';
const displaySubmissionId = getDisplaySubmissionId(mySubmission);
const submissionCreatedTime = getSubmissionCreatedTime(mySubmission);
const submissionTimeDisplay = submissionCreatedTime

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Consider handling the case where submissionCreatedTime is an invalid date. Using moment with an invalid date will result in 'Invalid date' being displayed. Ensure that getSubmissionCreatedTime returns a valid date or handle the invalid case explicitly.

);
let mmSubmissions = extractArrayFromStateSlice(state.challenge.mmSubmissions, challengeId);
if (!mmSubmissions.length && reviewSummations.length) {
mmSubmissions = buildMmSubmissionData(reviewSummations);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The function buildMmSubmissionData is called without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before calling this function to prevent potential runtime errors.

const { auth } = state;
let statisticsData = extractArrayFromStateSlice(state.challenge.statisticsData, challengeId);
if ((!Array.isArray(statisticsData) || !statisticsData.length) && reviewSummations.length) {
statisticsData = buildStatisticsData(reviewSummations);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The function buildStatisticsData is called without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before calling this function to prevent potential runtime errors.

state.challenge.reviewSummations,
challengeId,
);
let mmSubmissions = extractArrayFromStateSlice(state.challenge.mmSubmissions, challengeId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The variable mmSubmissions is reassigned with the result of buildMmSubmissionData without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before reassigning mmSubmissions to prevent potential runtime errors.

}
const { auth } = state;
let statisticsData = extractArrayFromStateSlice(state.challenge.statisticsData, challengeId);
if ((!Array.isArray(statisticsData) || !statisticsData.length) && reviewSummations.length) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The variable statisticsData is reassigned with the result of buildStatisticsData without checking if reviewSummations is an array. Consider adding a check to ensure reviewSummations is an array before reassigning statisticsData to prevent potential runtime errors.

@jmgasper jmgasper merged commit 70e7a16 into master Nov 19, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants