diff --git a/api/src/prescription/organization-learner/infrastructure/repositories/organization-learner-feature-repository.js b/api/src/prescription/organization-learner/infrastructure/repositories/organization-learner-feature-repository.js index 0b39ff1cfd7..95349f75e40 100644 --- a/api/src/prescription/organization-learner/infrastructure/repositories/organization-learner-feature-repository.js +++ b/api/src/prescription/organization-learner/infrastructure/repositories/organization-learner-feature-repository.js @@ -4,12 +4,12 @@ import { OrganizationLearner } from '../../domain/read-models/OrganizationLearne async function getOrganizationLearnersByFeature({ organizationId, featureKey }) { const knexConn = DomainTransaction.getConnection(); const rawOrganizationLearnerFeatures = await knexConn - .select('organization-learners.*') - .from('organization-learners') + .select('view-active-organization-learners.*') + .from('view-active-organization-learners') .join( 'organization-learner-features', 'organization-learner-features.organizationLearnerId', - 'organization-learners.id', + 'view-active-organization-learners.id', ) .join('features', 'features.id', 'organization-learner-features.featureId') .where({ key: featureKey, organizationId }); diff --git a/api/tests/prescription/organization-learner/integration/infrastructure/organization-learner-feature-repository_test.js b/api/tests/prescription/organization-learner/integration/infrastructure/organization-learner-feature-repository_test.js index 55bab826885..9ce015db973 100644 --- a/api/tests/prescription/organization-learner/integration/infrastructure/organization-learner-feature-repository_test.js +++ b/api/tests/prescription/organization-learner/integration/infrastructure/organization-learner-feature-repository_test.js @@ -10,7 +10,10 @@ describe('Prescription | OrganizationLearner | Integration | Infrastructure | Or await databaseBuilder.commit(); - const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey }); + const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ + organizationId, + featureKey, + }); expect(result).to.deep.equal([]); }); @@ -23,7 +26,10 @@ describe('Prescription | OrganizationLearner | Integration | Infrastructure | Or await databaseBuilder.commit(); - const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey }); + const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ + organizationId, + featureKey, + }); expect(result).to.deep.equal([]); }); @@ -63,7 +69,10 @@ describe('Prescription | OrganizationLearner | Integration | Infrastructure | Or const learner = new OrganizationLearner({ ...organizationLearner }); - const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ organizationId, featureKey }); + const result = await organizationLearnerFeatureRepository.getOrganizationLearnersByFeature({ + organizationId, + featureKey, + }); expect(result).to.deep.equal([learner]); });