Fix some minor "gotchas" with the dashboard / review summation handling#7181
Fix some minor "gotchas" with the dashboard / review summation handling#7181
Conversation
| if (!summation) { | ||
| return false; | ||
| } | ||
| const score = normalizeScoreValue(_.get(summation, 'aggregateScore')); |
There was a problem hiding this comment.
[performance]
The normalizeScoreValue function is called multiple times for the same aggregateScore value within the same loop iteration. Consider storing the result in a variable to avoid redundant computations.
| return; | ||
| } | ||
| const scoreType = getSummationScoreClassification(summation); | ||
| if (includeOnlyProvisional) { |
There was a problem hiding this comment.
[performance]
The includeOnlyProvisional check is performed inside the loop for each summation. If includeOnlyProvisional is false, this check is unnecessary and could be moved outside the loop to avoid redundant evaluations.
| let tokenV2 = cookies.tcjwt; | ||
| let tokenV3 = cookies.tcjwt; | ||
| // Support both historical cookie names used across environments. | ||
| const authToken = cookies.tcjwt || cookies.tcJwt; |
There was a problem hiding this comment.
[correctness]
The variable authToken is assigned the value of cookies.tcjwt || cookies.tcJwt. If both tcjwt and tcJwt are present, this will always prefer tcjwt. Ensure this behavior is intentional and aligns with the expected logic for handling these cookies.
No description provided.