Skip to content

Commit

Permalink
feat(orga): display new table column for shared profiles count
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBazin authored Nov 14, 2024
1 parent b4827ce commit 71b078d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
10 changes: 10 additions & 0 deletions orga/app/components/campaign/results/profile-list.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import ParticipationEvolutionIcon from './participation-evolution-icon';
{{/if}}
<col class="hide-on-mobile" />
<col class="hide-on-mobile" />
<col />
</colgroup>
<thead>
<tr>
Expand All @@ -67,6 +68,12 @@ import ParticipationEvolutionIcon from './participation-evolution-icon';
<TableHeader @align="center" class="hide-on-mobile">{{t
"pages.profiles-list.table.column.competences-certifiables"
}}</TableHeader>

{{#if @campaign.multipleSendings}}
<TableHeader @align="center" aria-label={{t "pages.profiles-list.table.column.ariaSharedProfileCount"}}>
{{t "pages.profiles-list.table.column.sharedProfileCount"}}
</TableHeader>
{{/if}}
</tr>
</thead>

Expand Down Expand Up @@ -116,6 +123,9 @@ import ParticipationEvolutionIcon from './participation-evolution-icon';
<td class="table__column--center hide-on-mobile">
{{profile.certifiableCompetencesCount}}
</td>
<td class="table__column--center">
{{profile.sharedProfileCount}}
</td>
</tr>
{{/each}}
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default class CampaignProfilesCollectionParticipationSummary extends Mode
@attr('string') participantExternalId;
@attr('date') sharedAt;
@attr('number') pixScore;
@attr('number') sharedProfileCount;
@attr('nullable-string') evolution;
@attr('boolean') certifiable;
@attr('number') certifiableCompetencesCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module('Integration | Component | Campaign::Results::ProfileList', function (hoo
});
});
module('table headers for multiple sendings campaign', function () {
test('it should display evolution header and tooltip when campaign is multiple sendings', async function (assert) {
test('it should display evolution header and tooltip and shared profile count when campaign is multiple sendings', async function (assert) {
// given
this.campaign = store.createRecord('campaign', {
id: '1',
Expand Down Expand Up @@ -74,9 +74,12 @@ module('Integration | Component | Campaign::Results::ProfileList', function (hoo
name: t('pages.profiles-list.table.column.evolution'),
});
assert.ok(within(evolutionHeader).getByText(t('pages.profiles-list.table.evolution-tooltip.content')));
assert.ok(
screen.getByRole('columnheader', { name: t('pages.profiles-list.table.column.ariaSharedProfileCount') }),
);
});

test('it should not display evolution header if campaign is not multiple sendings', async function (assert) {
test('it should not display evolution header or shared profile count if campaign is not multiple sendings', async function (assert) {
// given
this.campaign = store.createRecord('campaign', {
id: '1',
Expand All @@ -101,6 +104,9 @@ module('Integration | Component | Campaign::Results::ProfileList', function (hoo

// then
assert.notOk(screen.queryByRole('columnheader', { name: t('pages.profiles-list.table.column.evolution') }));
assert.notOk(
screen.queryByRole('columnheader', { name: t('pages.profiles-list.table.column.ariaSharedProfileCount') }),
);
});
});

Expand Down Expand Up @@ -209,6 +215,42 @@ module('Integration | Component | Campaign::Results::ProfileList', function (hoo
assert.ok(screen.getByRole('cell', { name: t('pages.profiles-list.table.evolution.unavailable') }));
});

test('it should display number of profiles shares', async function (assert) {
// given
this.campaign = store.createRecord('campaign', {
id: '1',
name: 'campagne 1',
participationsCount: 1,
multipleSendings: true,
});
this.profiles = [
{
firstName: 'John',
lastName: 'Doe',
participantExternalId: '123',
sharedProfileCount: 3,
evolution: 'decrease',
sharedAt: new Date(2020, 1, 1),
},
];
this.profiles.meta = { rowCount: 1 };

// when
const screen = await render(
hbs`<Campaign::Results::ProfileList
@campaign={{this.campaign}}
@profiles={{this.profiles}}
@onClickParticipant={{this.noop}}
@onFilter={{this.noop}}
@selectedDivisions={{this.divisions}}
@selectedGroups={{this.groups}}
/>`,
);

// then
assert.ok(screen.getByRole('cell', { name: '3' }));
});

test('it should display the profile list with external id', async function (assert) {
// given
this.campaign = store.createRecord('campaign', {
Expand Down

0 comments on commit 71b078d

Please sign in to comment.