Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ workflows:
only:
- develop
- pm-1127_1
- pm-4288
- pm-4288_1

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
9 changes: 9 additions & 0 deletions sql/reports/topcoder/completed-profiles-count.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ WHERE m.description IS NOT NULL
AND jsonb_array_length(mtp.value::jsonb -> 'preferredRoles') > 0
)
)
AND (
$2::boolean IS NULL

Choose a reason for hiding this comment

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

[⚠️ correctness]
The condition $2::boolean IS NULL OR (...) = $2::boolean could lead to unexpected behavior if $2 is not strictly a boolean or null. Ensure that $2 is always a boolean or null to avoid potential issues.

OR (
(
mtp.value::jsonb ? 'availability'
AND btrim(mtp.value->>'availability') <> ''

Choose a reason for hiding this comment

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

[⚠️ correctness]
Using btrim(mtp.value->>'availability') <> '' assumes that availability is always a string. If availability can be other types (e.g., null or a non-string type), this could lead to runtime errors. Consider adding a type check or ensuring the data type consistency.

) = $2::boolean
)
)
)
AND EXISTS (
SELECT 1
Expand Down
4 changes: 4 additions & 0 deletions src/reports/topcoder/topcoder-reports.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ type CompletedProfileRow = {
city: string | null;
skillCount: string | number | null;
principalSkills: string[] | null;
isOpenToWork?: boolean | null;
openToWork?: { availability?: string; preferredRoles?: string[] } | null;
};

type CompletedProfilesCountRow = {
Expand Down Expand Up @@ -699,6 +701,8 @@ export class TopcoderReportsService {
? Number(row.skillCount)
: undefined,
principalSkills: row.principalSkills || undefined,
openToWork: row.openToWork ?? null,

Choose a reason for hiding this comment

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

[💡 style]
Consider using undefined instead of null for openToWork to maintain consistency with other properties in the mapped object, which use undefined for missing values.

isOpenToWork: row.isOpenToWork ?? false,

Choose a reason for hiding this comment

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

[⚠️ correctness]
The default value for isOpenToWork is set to false. Ensure this aligns with the intended logic, as it might affect filtering or display logic elsewhere in the application.

}));

return {
Expand Down
Loading