Skip to content

Commit

Permalink
[FEATURE] Voir le nombre de sujets évalués lors de la consultation d'…
Browse files Browse the repository at this point in the history
…un PC sur Pix Admin (PIX-9042)

 #10272
  • Loading branch information
pix-service-auto-merge authored Oct 9, 2024
2 parents dc7cc17 + 0a4a259 commit 7198329
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions admin/app/components/target-profiles/target-profile.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ export default class TargetProfile extends Component {
"pages.target-profiles.resettable-checkbox.label"
}}&#x20;:&#x20;</span>{{this.displayBooleanState this.areKnowledgeElementsResettable}}
</li>
<li><span class="bold">{{t
"pages.target-profiles.tubes-count"
}}&#x20;:&#x20;</span>{{@model.tubesCount}}</li>
{{#if @model.description}}
<li>
<span class="bold">Description&#x20;:&#x20;</span>
Expand Down
1 change: 1 addition & 0 deletions admin/app/models/target-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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(<template><TargetProfile @model={{model}} /></template>);

// 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
Expand Down
3 changes: 2 additions & 1 deletion admin/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion admin/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const serialize = function ({ targetProfile, filter }) {
'stageCollection',
'areas',
'maxLevel',
'tubesCount',
'cappedTubes',
],
badges: {
Expand Down
1 change: 1 addition & 0 deletions api/src/shared/domain/models/TargetProfileForAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class TargetProfileForAdmin {
allSkills: skills,
}),
);
this.tubesCount = tubes.length;
}

get cappedTubes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7198329

Please sign in to comment.