Skip to content

Commit

Permalink
♻️ refactor: use active o-learner view only
Browse files Browse the repository at this point in the history
Co-Authored-By: Aurélie Crouillebois <[email protected]>
  • Loading branch information
yaf and aurelie-crouillebois committed Oct 24, 2024
1 parent f99c82f commit 4e6914c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});
Expand All @@ -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([]);
});
Expand Down Expand Up @@ -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]);
});
Expand Down

0 comments on commit 4e6914c

Please sign in to comment.