diff --git a/admin/app/components/target-profiles/target-profile.gjs b/admin/app/components/target-profiles/target-profile.gjs index 9a9ded85024..f3fcf059ac4 100644 --- a/admin/app/components/target-profiles/target-profile.gjs +++ b/admin/app/components/target-profiles/target-profile.gjs @@ -208,6 +208,9 @@ export default class TargetProfile extends Component { "pages.target-profiles.resettable-checkbox.label" }} : {{this.displayBooleanState this.areKnowledgeElementsResettable}} +
  • {{t + "pages.target-profiles.tubes-count" + }} : {{@model.tubesCount}}
  • {{#if @model.description}}
  • Description : diff --git a/admin/app/models/target-profile.js b/admin/app/models/target-profile.js index aa363ceacd6..38bdf2d1782 100644 --- a/admin/app/models/target-profile.js +++ b/admin/app/models/target-profile.js @@ -33,6 +33,7 @@ export default class TargetProfile extends Model { @attr('boolean') hasLinkedCampaign; @attr('boolean') hasLinkedAutonomousCourse; @attr('number') maxLevel; + @attr('number') tubesCount; @attr() cappedTubes; @hasMany('badge', { async: true, inverse: null }) badges; diff --git a/admin/tests/integration/components/target-profiles/target-profile-test.gjs b/admin/tests/integration/components/target-profiles/target-profile-test.gjs index 5642ed6476e..a54cc5e7174 100644 --- a/admin/tests/integration/components/target-profiles/target-profile-test.gjs +++ b/admin/tests/integration/components/target-profiles/target-profile-test.gjs @@ -1,4 +1,5 @@ import { render } from '@1024pix/ember-testing-library'; +import { t } from 'ember-intl/test-support'; import TargetProfile from 'pix-admin/components/target-profiles/target-profile'; import { module, test } from 'qunit'; @@ -19,9 +20,29 @@ module('Integration | Component | TargetProfile', function (hooks) { name: 'Dummy target-profile', outdated: false, ownerOrganizationId: '100', + tubesCount: 6, }; - module('campaign / autonomous course link', function () { + module('target profile overview section', function () { + module('basic informations', function () { + test('it should display target profile basic informations', async function (assert) { + //given + const model = { ...targetProfileSampleData }; + + // when + const screen = await render(); + + // then + assert.ok(_findByListItemText(screen, `ID : ${model.id}`)); + assert.ok(_findByListItemText(screen, `Organisation de référence : ${model.ownerOrganizationId}`)); + assert.ok(_findByListItemText(screen, 'Date de création : 01/03/2024')); + assert.ok(_findByListItemText(screen, 'Obsolète : Non')); + assert.ok(_findByListItemText(screen, 'Parcours Accès Simplifié : Non')); + assert.ok(_findByListItemText(screen, `${t('pages.target-profiles.resettable-checkbox.label')} : Non`)); + assert.ok(_findByListItemText(screen, `${t('pages.target-profiles.tubes-count')} : ${model.tubesCount}`)); + }); + }); + module('when no campaign is linked', function () { test('it should display a no-link information', async function (assert) { // given diff --git a/admin/translations/en.json b/admin/translations/en.json index 64d2a45eed5..1760120c041 100644 --- a/admin/translations/en.json +++ b/admin/translations/en.json @@ -644,7 +644,8 @@ }, "resettable-checkbox": { "label": "Allow resetting for evaluation-type campaigns when multiple submissions are enabled for the organisation" - } + }, + "tubes-count": "Number of subjects included in this target profile" }, "trainings": { "training": { diff --git a/admin/translations/fr.json b/admin/translations/fr.json index a0632917f50..ef3b9ddbfcc 100644 --- a/admin/translations/fr.json +++ b/admin/translations/fr.json @@ -661,7 +661,8 @@ }, "resettable-checkbox": { "label": "Permettre la remise à zéro des acquis du profil cible" - } + }, + "tubes-count": "Nombre de sujets compris dans ce profil cible" }, "trainings": { "training": { diff --git a/api/lib/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer.js b/api/lib/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer.js index 637c077e296..95eca9eb73f 100644 --- a/api/lib/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer.js +++ b/api/lib/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer.js @@ -44,6 +44,7 @@ const serialize = function ({ targetProfile, filter }) { 'stageCollection', 'areas', 'maxLevel', + 'tubesCount', 'cappedTubes', ], badges: { diff --git a/api/src/shared/domain/models/TargetProfileForAdmin.js b/api/src/shared/domain/models/TargetProfileForAdmin.js index 7f16c718643..db7b7dcc8b0 100644 --- a/api/src/shared/domain/models/TargetProfileForAdmin.js +++ b/api/src/shared/domain/models/TargetProfileForAdmin.js @@ -54,6 +54,7 @@ class TargetProfileForAdmin { allSkills: skills, }), ); + this.tubesCount = tubes.length; } get cappedTubes() { diff --git a/api/tests/acceptance/application/target-profiles/index_test.js b/api/tests/acceptance/application/target-profiles/index_test.js index 763393707ca..de64092c2a1 100644 --- a/api/tests/acceptance/application/target-profiles/index_test.js +++ b/api/tests/acceptance/application/target-profiles/index_test.js @@ -221,6 +221,7 @@ describe('Acceptance | Route | target-profiles', function () { 'are-knowledge-elements-resettable': false, 'capped-tubes': [], category: 'TEST', + 'tubes-count': 1, comment: 'Un beau profil cible', description: 'Une description', 'created-at': new Date('2020-01-01'), diff --git a/api/tests/unit/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer_test.js b/api/tests/unit/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer_test.js index d20239b3269..01fb0fdca1f 100644 --- a/api/tests/unit/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer_test.js +++ b/api/tests/unit/infrastructure/serializers/jsonapi/target-profile-for-admin-serializer_test.js @@ -201,6 +201,7 @@ describe('Unit | Serializer | JSONAPI | target-profile-for-admin-serializer', fu 'owner-organization-id': 12, 'has-linked-campaign': false, 'has-linked-autonomous-course': false, + 'tubes-count': 3, 'capped-tubes': [ { id: 'recTube1',