Skip to content

PM-4158 - Update profiles report#57

Merged
vas3a merged 5 commits intodevelopfrom
PM-4158_completed-profiles-report
Mar 4, 2026
Merged

PM-4158 - Update profiles report#57
vas3a merged 5 commits intodevelopfrom
PM-4158_completed-profiles-report

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Mar 4, 2026

https://topcoder.atlassian.net/browse/PM-4168 - Open To Work - Profile Completion

@vas3a vas3a requested review from jmgasper and kkartunov March 4, 2026 12:28
SELECT DISTINCT
ma."userId"
FROM members."memberAddress" ma
WHERE ma.city IS NOT NULL
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider adding a check for ma."homeCountryCode" being non-null in the member_location CTE to ensure consistency with the profile completion criteria outlined in the comments.

ON mtp."memberTraitId" = mt.id
WHERE mt."traitId" = 'personalization'
AND mtp.value IS NOT NULL
AND mtp.value::jsonb ? 'openToWork'
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The condition mtp.value::jsonb ? 'openToWork' checks for the presence of the key but does not verify its value. Ensure that the presence of this key alone is sufficient for the logic or consider checking its value if necessary.

AND mtp.value IS NOT NULL
AND mtp.value::jsonb ? 'availability'
AND mtp.value::jsonb ->> 'availability' IS NOT NULL
AND mtp.value::jsonb ? 'preferredRoles'
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The removal of the check jsonb_typeof(mtp.value::jsonb -> 'availability') = 'boolean' could lead to incorrect data being considered valid. Ensure that the availability field is always a boolean to maintain data integrity.

ON mtp."memberTraitId" = mt.id
WHERE mtp.key = 'openToWork'
AND mtp.value IS NOT NULL
AND (
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The logic for checking availability and preferredRoles has changed. Previously, both availability and preferredRoles were required. Now, availability is optional if preferredRoles is present and non-empty. Ensure this change aligns with the intended business logic, as it alters the criteria for a completed profile.

AND me."userId" IS NOT NULL
AND ml."userId" IS NOT NULL
AND ($1::text IS NULL OR COALESCE(m."homeCountryCode", m."competitionCountryCode") = $1)
HAVING COUNT(*) >= 3 -- Filter early to reduce dataset
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The HAVING COUNT(*) >= 3 clause is used to filter users with at least 3 skills early in the member_skills CTE. This is a good optimization to reduce the dataset size early on. However, ensure that this logic aligns with the business requirements, as it might exclude users who have fewer than 3 skills but meet other profile completion criteria.

COALESCE(m."homeCountryCode", m."competitionCountryCode") AS "countryCode",
m.country AS "countryName"
FROM members.member m
INNER JOIN member_skills ms ON ms.user_id = m."userId"
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The INNER JOIN on member_skills ensures that only members with at least 3 skills are included. This is a change from the previous LEFT JOIN which allowed members with fewer skills to be included. Verify that this change aligns with the intended logic for profile completion.

AND m."photoURL" IS NOT NULL
AND m."photoURL" <> ''
AND m."homeCountryCode" IS NOT NULL
AND ($1::text IS NULL OR COALESCE(m."homeCountryCode", m."competitionCountryCode") = $1)
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The condition m."homeCountryCode" IS NOT NULL is used to filter members. Ensure that this condition is necessary and does not conflict with the logic that uses COALESCE(m."homeCountryCode", m."competitionCountryCode") for determining the countryCode. If homeCountryCode is always required, consider removing the COALESCE logic.

@vas3a vas3a merged commit 45ecf70 into develop Mar 4, 2026
5 of 6 checks passed
@vas3a vas3a deleted the PM-4158_completed-profiles-report branch March 4, 2026 13:38
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