Skip to content

Commit

Permalink
Remove unneeded join on worker training table as we don't need all tr…
Browse files Browse the repository at this point in the history
…aining to determine if training cert exists for workplace or sub
  • Loading branch information
duncanc19 committed Nov 8, 2024
1 parent 154c1f4 commit 6328857
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions backend/server/models/establishment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2400,8 +2400,7 @@ module.exports = function (sequelize, DataTypes) {
`
SELECT 1 FROM cqc."Establishment" establishment
INNER JOIN cqc."Worker" worker ON establishment."EstablishmentID" = worker."EstablishmentFK"
INNER JOIN cqc."WorkerTraining" workerTraining ON worker."ID" = workerTraining."WorkerFK"
INNER JOIN cqc."TrainingCertificates" trainingCertificate ON workerTraining."WorkerFK" = trainingCertificate."WorkerFK"
INNER JOIN cqc."TrainingCertificates" trainingCertificate ON worker."ID" = trainingCertificate."WorkerFK"
WHERE establishment."Archived" = false AND worker."Archived" = false
AND (establishment."EstablishmentID" = :workplaceId OR establishment."ParentID" = :workplaceId)
LIMIT 1;
Expand Down

0 comments on commit 6328857

Please sign in to comment.