Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE][BACK] Exposer les meta données pour la reconciliation des imports à format (PIX-13234) #9414

Merged
merged 11 commits into from
Jul 8, 2024

Conversation

xav-car
Copy link
Contributor

@xav-car xav-car commented Jul 1, 2024

🦄 Problème

Pour permettre aux apprenants d'une organization ayant l'import générique de se reconcilier, nous avons besoin de savoir quels champs permettent la réconciliation de cet apprenant

🤖 Proposition

Exposer les champs nécessaires à la réconciliation d'un apprenant par rapport à la config de l'import à format

🌈 Remarques

Le FRONT sera fait dans un second temps afin d'éviter une trop grosse PR

💯 Pour tester

CI au vert ( aller faire un test func sur la PR FRONT )

@xav-car xav-car marked this pull request as ready for review July 1, 2024 14:52
@xav-car xav-car requested review from a team as code owners July 1, 2024 14:52
@pix-bot-github
Copy link

Une fois les applications déployées, elles seront accessibles via les liens suivants :

Les variables d'environnement seront accessibles via les liens suivants :

@@ -78,6 +80,10 @@ class CampaignToJoin {
get isFlash() {
return this.assessmentMethod === Assessment.methods.FLASH;
}

#computeisRestrictedAccess(isManagingStudents, hasImportLearnerFeature) {
Copy link
Contributor

@machestla machestla Jul 3, 2024

Choose a reason for hiding this comment

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

Suggestion :

  • soit renommer en computeIsRestrictedAccess
  • soit mettre l'ensemble en inline dans le constructor
  • soit avoir un getter (option choisie ensemble)

Copy link
Contributor

Choose a reason for hiding this comment

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

en fait le getter est pas possible car on recoit des param dans le constructeur qu'on ne stocke pas, j'ai préféré inliner le code du computeIsRestrictedAccess dans le constructor

@@ -63,4 +63,50 @@ describe('Unit | Domain | Models | CampaignToJoin', function () {
expect(campaignToJoin.isAccessible).to.be.true;
});
});

describe('#isRestrictedAccess', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion : renommer le titre selon le nom de la propriété

@@ -1,5 +1,6 @@
import { knex } from '../../../../../db/knex-database-connection.js';
import { NotFoundError } from '../../../../../lib/domain/errors.js';
import * as organizationFeatureAPI from '../../../../organizational-entities/application/api/organization-features-api.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

To do: injecter la dépendance au lieu de faire un import

@@ -50,6 +52,26 @@ describe('Integration | Repository | CampaignToJoin', function () {
expect(actualCampaign.identityProvider).to.equal(OidcIdentityProviders.POLE_EMPLOI.code);
});

it('should return restricted access if organization has learner import feature', async function () {
// given
const organization = databaseBuilder.factory.buildOrganization({ isManagingStudents: false });
Copy link
Contributor

Choose a reason for hiding this comment

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

To do : une fois l'injection de dépendance faite, nous n'aurons pas besoin de "re-"tester cette partie là donc nous n'aurons pas besoin de recréer une organization ou une featureId

@@ -7,7 +7,7 @@ import { usecases } from '../../../../../src/prescription/campaign-participation
import { ApplicationTransaction } from '../../../../../src/prescription/shared/infrastructure/ApplicationTransaction.js';
import { domainBuilder, expect, hFake, sinon } from '../../../../test-helper.js';

describe('Unit | Application | Controller | Campaign-Participation', function () {
describe('Unit | Application | Controller | learner-Participation', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

To do : mettre une majuscule à Learner

@@ -1,7 +1,7 @@
import { campaignParticipationController } from '../../../../lib/application/campaign-participations/campaign-participation-controller.js';
import { usecases as devcompUsecases } from '../../../../src/devcomp/domain/usecases/index.js';
import { expect, sinon } from '../../../test-helper.js';
describe('Unit | Application | Controller | Campaign-Participation', function () {
describe('Unit | Application | Controller | Campaign-Participation (lib)', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion : retirer (lib)

@@ -9,10 +9,12 @@ const save = async function (request, h, dependencies = { campaignParticipationS
const userId = request.auth.credentials.userId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion : drop ce commit car potentiellement on augmente la dette vis à vis de cette PR

@@ -3,6 +3,7 @@
*/
import { knex } from '../../../../db/knex-database-connection.js';
import * as knexUtils from '../../../../src/shared/infrastructure/utils/knex-utils.js';
import { ApplicationTransaction } from '../../../prescription/shared/infrastructure/ApplicationTransaction.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

to do : drop ce commit aussi car utilise uniquement ce qui se trouve dans le commit précédent

this.multipleSendings = multipleSendings;
this.assessmentMethod = assessmentMethod;
this.skillCount = skillCount;
this.organizationId = organizationId;
this.deletedAt = deletedAt;
this.#computeisRestrictedAccess(isManagingStudents, hasLearnersImportFeature);
Copy link
Contributor

@machestla machestla Jul 3, 2024

Choose a reason for hiding this comment

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

to do :

  • appliquer la même modification que pour CampaignToJoin
  • ajouter dans la dette technique : regarder la différence entre CampaignToJoin et CampaignToStartParticipation
    • soit se baser sur le model Campaign pour les deux
    • soit les merger ensemble s'ils font la même chose

@@ -226,13 +226,34 @@ describe('Unit | Domain | Models | CampaignParticipant', function () {
let restrictedCampaign;
beforeEach(function () {
userIdentity = { id: 1 };
});

it('throws a ForbiddenAccess exception when the user is not in the organization trainees on managingStudents cases', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

To do : remplacer "trainees" par "learners"

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion : déplacer ce fichier dans le commit où la gestion d'erreur est faite

@@ -8,12 +8,12 @@ import {
import { OrganizationLearnerForStartingParticipation } from '../../../../../lib/domain/read-models/OrganizationLearnerForStartingParticipation.js';
import { UserIdentity } from '../../../../../lib/domain/read-models/UserIdentity.js';
import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js';
import * as organizationImportFeatureApi from '../../../../organizational-entities/application/api/organization-features-api.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

To do : remplacer par l'injection de dépendance

this.#computeisRestrictedAccess(organizationIsManagingStudents, hasLearnersImportFeature);
this.reconciliationFields = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion : remonter cette ligne une ligne plus haut

@@ -109,4 +109,46 @@ describe('Unit | Domain | Models | CampaignToJoin', function () {
expect(campaignToJoin.isRestricted).to.be.false;
});
});

describe('#setReconciliationFields', function () {
it('should return null when no reconcilation defined', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion :
it('should return null when no reconciliation defined', function () {

});

describe('#isReconciliationRequired', function () {
it('should return false when feature not enabled with reconcilationFields', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion :
t('should return false when feature not enabled with reconciliationFields', function () {

@lionelB lionelB force-pushed the pix-13234/expose-reconciliation-meta branch 5 times, most recently from b028f4c to 5da82f8 Compare July 3, 2024 21:54
@lionelB lionelB force-pushed the pix-13234/expose-reconciliation-meta branch from 5da82f8 to 61fd17c Compare July 8, 2024 08:31
@pix-service-auto-merge pix-service-auto-merge force-pushed the pix-13234/expose-reconciliation-meta branch from 61fd17c to 14d15ba Compare July 8, 2024 08:31
@pix-service-auto-merge pix-service-auto-merge merged commit f448c8d into dev Jul 8, 2024
6 of 7 checks passed
@pix-service-auto-merge pix-service-auto-merge deleted the pix-13234/expose-reconciliation-meta branch July 8, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants