Skip to content

feat(PM-4288): Open to work column and filter implementation#60

Merged
hentrymartin merged 5 commits intodevelopfrom
pm-4288
Mar 12, 2026
Merged

feat(PM-4288): Open to work column and filter implementation#60
hentrymartin merged 5 commits intodevelopfrom
pm-4288

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • Added the functionality to expose open to work column and a filter on it.

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

ORDER BY mt."updatedAt" DESC
LIMIT 1
) ot ON TRUE
LEFT JOIN LATERAL (

Choose a reason for hiding this comment

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

[⚠️ performance]
Using LEFT JOIN LATERAL with ON TRUE can lead to performance issues if the subquery is complex or returns a large dataset. Consider whether this is necessary or if a different join condition could be more efficient.

ORDER BY m.handle
LIMIT $2::int
OFFSET $3::int;
LIMIT $3::int

Choose a reason for hiding this comment

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

[❗❗ security]
Ensure that the LIMIT and OFFSET values are validated before being passed to the query to prevent potential SQL injection vulnerabilities.

perPage = 50,
openToWork?: boolean,
) {
const safePage = Number.isFinite(page) ? Math.max(Math.floor(page), 1) : 1;

Choose a reason for hiding this comment

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

[⚠️ correctness]
The safePage calculation uses Math.floor(page), which could lead to unexpected results if page is a non-integer. Consider using Math.ceil(page) to ensure that any fractional page numbers round up to the next whole page, or validate that page is an integer before this calculation.

) {
const safePage = Number.isFinite(page) ? Math.max(Math.floor(page), 1) : 1;
const safePerPage = Number.isFinite(perPage)
? Math.min(Math.max(Math.floor(perPage), 1), 200)

Choose a reason for hiding this comment

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

[⚠️ correctness]
The safePerPage calculation uses Math.floor(perPage), which could lead to unexpected results if perPage is a non-integer. Consider using Math.ceil(perPage) to ensure that any fractional perPage numbers round up to the next whole number, or validate that perPage is an integer before this calculation.

typeof openToWork === "boolean" ? openToWork : null,
],
);
const total = Number(countRows?.[0]?.total ?? 0);

Choose a reason for hiding this comment

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

[⚠️ correctness]
The total variable is calculated using Number(countRows?.[0]?.total ?? 0). If total is expected to be a non-negative integer, consider adding validation to ensure that countRows?.[0]?.total is a valid number before conversion.

@@ -689,6 +698,7 @@ export class TopcoderReportsService {
row.skillCount !== null && row.skillCount !== undefined

Choose a reason for hiding this comment

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

[⚠️ correctness]
The conversion of row.skillCount to a number assumes that row.skillCount is a valid numeric string or number. Consider adding validation to handle cases where row.skillCount might not be a valid number.

@hentrymartin hentrymartin requested a review from kkartunov March 12, 2026 11:22
@hentrymartin hentrymartin merged commit ed140cc into develop Mar 12, 2026
5 of 6 checks passed
@hentrymartin hentrymartin deleted the pm-4288 branch March 12, 2026 15:30
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.

2 participants