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] Ajouter la date d'extraction à la page statistiques sur Pix Orga (PIX-15458). #10817

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading