Hotfix for NASA crater detection challenge results#7180
Conversation
| const tokenBecameAvailable = !previousToken && !!nextToken; | ||
|
|
||
| if ( | ||
| checkIsMM(nextProps.challenge) |
There was a problem hiding this comment.
[💡 maintainability]
The condition checkIsMM(nextProps.challenge) is used multiple times in this method. Consider extracting it into a variable for better readability and maintainability.
| && nextProps.statisticsData.length > 0; | ||
| const enteringMmDashboard = selectedTab !== DETAIL_TABS.MM_DASHBOARD | ||
| && nextProps.selectedTab === DETAIL_TABS.MM_DASHBOARD; | ||
| const tokenBecameAvailable = !previousToken && !!nextToken; |
There was a problem hiding this comment.
[correctness]
The variable enteringMmDashboard is defined but not used in the subsequent logic. Ensure this condition is necessary or remove it to avoid confusion.
| const hasProvisionalScore = !_.isNil( | ||
| normalizeScoreValue(submission.provisionalScore), | ||
| ); | ||
| if (!hasFinalScore || hasProvisionalScore || _.isNil(latestProvisionalScore)) { |
There was a problem hiding this comment.
[💡 readability]
The condition if (!hasFinalScore || hasProvisionalScore || _.isNil(latestProvisionalScore)) is complex and may lead to confusion. Consider breaking it down into smaller, named boolean variables to improve readability.
| if (_.isNil(score)) { | ||
| return; | ||
| } | ||
| if (includeOnlyProvisional) { |
There was a problem hiding this comment.
[maintainability]
The check if (_.isNil(score)) { return; } is repeated in both buildMmSubmissionData and buildStatisticsData. Consider extracting this logic into a helper function to avoid duplication and improve maintainability.
| return; | ||
| } | ||
| if (includeOnlyProvisional) { | ||
| const scoreType = getSummationScoreClassification(summation); |
There was a problem hiding this comment.
[maintainability]
The logic for determining whether to include only provisional scores is duplicated in both buildMmSubmissionData and buildStatisticsData. Consider refactoring this into a shared utility function to reduce redundancy.
…nto hotfix-review-summations
No description provided.