- Notifications
You must be signed in to change notification settings - Fork6
Master -> develop sync#40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
[v6 PROD RELEASE] - dev -> master
PS-441 fix for phase predecessor calculations on update
| CREATESCHEMAIF NOT EXISTS reviews; | ||
| CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA skills; | ||
| CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[design]
Thepg_trgm extension is being created in thepg_catalog schema. Typically, extensions are created in thepublic schema or a specific schema relevant to the application. Ensure that this is intentional and that the application logic accounts for this schema placement.
| CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA skills; | ||
| CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog; | ||
| CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA reviews; | ||
| CREATE EXTENSION IF NOT EXISTS"uuid-ossp" WITH SCHEMA skills; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[design]
Theuuid-ossp extension is being created in theskills schema. This is unusual as extensions are often placed in thepublic schema. Verify that this schema choice is deliberate and that it aligns with the application's schema management strategy.
| JOIN pg_namespace nsONns.oid=idx.relnamespace | ||
| WHEREidx.relname='challenge_phase_challenge_open_end_idx' | ||
| ANDns.nspname= challenge_phase_schema | ||
| AND pg_get_indexdef(idx.oid)LIKE'%("challengeId", "isOpen", "scheduledEndDate", "actualEndDate", name)%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[maintainability]
Thepg_get_indexdef function is used with aLIKE clause to check index definitions. This approach can be fragile if the index definition changes in ways not accounted for by theLIKE pattern. Consider using a more robust method to verify index structure, if possible.
| @@ -0,0 +1,30 @@ | |||
| -- View to use in performance updates (PM-2206) | |||
| DROPVIEW IF EXISTS"challenges"."MemberChallengeAccess"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[❗❗correctness]
Dropping the view without checking if it exists first could lead to errors if the view is not present. Consider usingDROP VIEW IF EXISTS to avoid potential errors.
| ) THEN | ||
| EXECUTE format( | ||
| 'CREATE VIEW %I.%I AS | ||
| SELECT DISTINCT r."challengeId", r."memberId" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[performance]
UsingSELECT DISTINCT can be resource-intensive. Ensure that this is necessary for the use case, as it may impact performance.
| 'CREATE VIEW %I.%I AS | ||
| SELECT DISTINCT r."challengeId", r."memberId" | ||
| FROM resources."Resource" r | ||
| WHERE r."challengeId" IS NOT NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[performance]
The conditionr."challengeId" IS NOT NULL AND r."memberId" IS NOT NULL is used to filter out null values. Ensure that these columns are indexed if they are frequently queried, to improve performance.
| termsChallengeTerm[] | ||
| skillsChallengeSkill[] | ||
| auditLogsAuditLog[] | ||
| memberAccessesMemberChallengeAccess[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[maintainability]
The addition ofmemberAccesses in theChallenge model introduces a new relation toMemberChallengeAccess. Ensure that theMemberChallengeAccess model is correctly populated and maintained, as any orphaned records could lead to inconsistencies. Consider adding cascading delete or update rules if appropriate.
| challengeChallenge@relation(fields:[challengeId],references:[id]) | ||
| @@id([challengeId,memberId]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[❗❗correctness]
The composite primary key@@id([challengeId, memberId]) inMemberChallengeAccess ensures uniqueness of member/challenge pairs. Verify that this constraint aligns with the intended data model and that no existing data violates this constraint.
| timelineTemplateId | ||
| ); | ||
| const{ phaseDefinitionMap}=awaitthis.getPhaseDefinitionsAndMap(); | ||
| constchallengePhaseIds=newSet(_.map(challengePhases,"phaseId")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[performance]
Consider using_.keyBy instead of_.map followed bynew Set to directly create a set of phase IDs. This could improve performance by reducing the number of iterations overchallengePhases.
| phaseId:phase.predecessor, | ||
| }); | ||
| if(_.isNil(predecessorPhase)){ | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[correctness]
Thecontinue statement here skips processing phases without a valid predecessor. Ensure that this behavior is intentional and that skipping these phases won't lead to incorrect scheduling or logic errors.
016a1b3 intodevelopUh oh!
There was an error while loading.Please reload this page.
No description provided.