Skip to content

Commit

Permalink
[FEATURE] Ajouter la date d'extraction à la page statistiques sur Pix…
Browse files Browse the repository at this point in the history
… Orga (PIX-15458).

 #10817
  • Loading branch information
pix-service-auto-merge authored Dec 13, 2024
2 parents 73f6e20 + cd9d814 commit c40e0dc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions orga/app/components/statistics/index.gjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PixPagination from '@1024pix/pix-ui/components/pix-pagination';
import { service } from '@ember/service';
import Component from '@glimmer/component';
import dayjs from 'dayjs';
import { t } from 'ember-intl';

import Header from '../table/header';
Expand Down Expand Up @@ -39,9 +40,15 @@ export default class Statistics extends Component {
return this.analysisByTubes.slice(start, end);
}

get extractedDate() {
return dayjs(this.analysisByTubes[0]?.extraction_date).format('D MMM YYYY');
}

<template>
<div class="statistics-page__header">
<h1 class="page-title">{{t "pages.statistics.title"}}</h1>
<span class="statistics-page-header__date">{{t "pages.statistics.before-date"}}
{{this.extractedDate}}</span>
</div>

<section class="statistics-page__section">
Expand Down
4 changes: 4 additions & 0 deletions orga/app/styles/components/statistics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
margin-bottom: var(--pix-spacing-8x);
}

.statistics-page-header__date {
@extend %pix-body-xs;
}

.statistics-page__section {
tbody > tr {
&:nth-child(odd) {
Expand Down
16 changes: 14 additions & 2 deletions orga/tests/integration/components/statistics/index-test.gjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { render } from '@1024pix/ember-testing-library';
import Service from '@ember/service';
import dayjs from 'dayjs';
import { t } from 'ember-intl/test-support';
import Statistics from 'pix-orga/components/statistics/index';
import { module, test } from 'qunit';
Expand All @@ -9,17 +10,28 @@ import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering';
module('Integration | Component | Statistics | Index', function (hooks) {
setupIntlRenderingTest(hooks);

test('it should display title', async function (assert) {
test('it should display title and extracted date', async function (assert) {
//given
const extractionDate = '2024-12-08';
const model = {
data: [],
data: [
{
competence_code: '2.1',
competence: 'Interagir',
sujet: 'Gérer ses contacts',
niveau_par_user: '1.30',
niveau_par_sujet: '1.50',
extraction_date: extractionDate,
},
],
};

//when
const screen = await render(<template><Statistics @model={{model}} /></template>);

//then
assert.ok(screen.getByRole('heading', { name: t('pages.statistics.title'), level: 1 }));
assert.ok(screen.getByText(dayjs(extractionDate).format('D MMM YYYY'), { exact: false }));
});

test('it should display table headers', async function (assert) {
Expand Down
1 change: 1 addition & 0 deletions orga/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,7 @@
},
"statistics": {
"title": "Statistics",
"before-date": "on",
"gauge": {
"label": "On the topic, your participants achieved a level of {userLevel} out of a maximum reachable level of {tubeLevel}."
},
Expand Down
1 change: 1 addition & 0 deletions orga/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@
},
"statistics": {
"title": "Statistiques",
"before-date": "au",
"gauge": {
"label": "Sur le sujet vos participants ont obtenu un niveau de {userLevel} sur un niveau maximum atteignable de {tubeLevel}."
},
Expand Down
1 change: 1 addition & 0 deletions orga/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,7 @@
},
"statistics": {
"title": "Statistieken",
"before-date": "op",
"gauge": {
"label": "Je deelnemers behaalden een {userLevel} op een maximaal haalbaar niveau van {tubeLevel}."
},
Expand Down

0 comments on commit c40e0dc

Please sign in to comment.