Skip to content

feat(PM-4068): Implemented categorized skills with max limit of number of skills shown per category in PDF download#87

Open
hentrymartin wants to merge 4 commits intodevelopfrom
pm-4068
Open

feat(PM-4068): Implemented categorized skills with max limit of number of skills shown per category in PDF download#87
hentrymartin wants to merge 4 commits intodevelopfrom
pm-4068

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • Implemented categorized skills with max limit of number of skills shown per category in PDF download

Ticket link - https://topcoder.atlassian.net/browse/PM-4068

LIST_FETCH_COUNT: process.env.MAILCHIMP_LIST_FETCH_COUNT ? Number(process.env.MAILCHIMP_LIST_FETCH_COUNT) : 1000
}
},
PDF_SKILLS_PER_CATEGORY: process.env.PDF_SKILLS_PER_CATEGORY ? Number(process.env.PDF_SKILLS_PER_CATEGORY) : 5,

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider validating that process.env.PDF_SKILLS_PER_CATEGORY is a positive integer before converting it with Number(). This will prevent potential issues if the environment variable is set to a non-numeric or negative value.

* Create one category line in same style as verified/not verified: bullet label + skills on same line
*/
function createCategorySkillsBlock (categoryName, skillNames) {
if (!skillNames || skillNames.length === 0) return null

Choose a reason for hiding this comment

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

[⚠️ correctness]
Returning null when skillNames is empty might lead to unexpected behavior if the caller does not handle null values properly. Consider returning an empty React element instead to avoid potential issues.

skillsContent.push(principalSubsection)
const hasPrincipalSkills = skills && skills.principal && (skills.principal.verified.length > 0 || skills.principal.notVerified.length > 0)
const hasAdditionalByCategory = skillsByCategory && skillsByCategory.length > 0
if (hasPrincipalSkills || hasAdditionalByCategory) {

Choose a reason for hiding this comment

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

[⚠️ correctness]
The condition skillsByCategory && skillsByCategory.length > 0 assumes skillsByCategory is always an array. If skillsByCategory can be null or undefined, this is fine, but if it can be another type, consider adding a type check to ensure it is an array.

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.

1 participant