feat: Calculer automatiquement les moyennes après chaque saisie de notes
Les enseignants ont besoin de moyennes à jour immédiatement après la publication ou modification des notes, sans attendre un batch nocturne. Le système recalcule via Domain Events synchrones : statistiques d'évaluation (min/max/moyenne/médiane), moyennes matières pondérées (normalisation /20), et moyenne générale par élève. Les résultats sont stockés dans des tables dénormalisées avec cache Redis (TTL 5 min). Trois endpoints API exposent les données avec contrôle d'accès par rôle. Une commande console permet le backfill des données historiques au déploiement.
This commit is contained in:
@@ -61,7 +61,7 @@ test.describe('Admin Class Detail Page [P1]', () => {
|
||||
await page.locator('#email').fill(ADMIN_EMAIL);
|
||||
await page.locator('#password').fill(ADMIN_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/dashboard/, { timeout: 30000 }),
|
||||
page.waitForURL(/\/dashboard/, { timeout: 60000 }),
|
||||
page.getByRole('button', { name: /se connecter/i }).click()
|
||||
]);
|
||||
}
|
||||
@@ -151,8 +151,16 @@ test.describe('Admin Class Detail Page [P1]', () => {
|
||||
await page.getByRole('button', { name: /créer la classe/i }).click();
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Search for the newly created class to handle pagination
|
||||
const searchModify = page.locator('input[type="search"]');
|
||||
if (await searchModify.isVisible()) {
|
||||
await searchModify.fill(originalName);
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
// Navigate to edit page
|
||||
const classCard = page.locator('.class-card', { hasText: originalName });
|
||||
await expect(classCard).toBeVisible({ timeout: 15000 });
|
||||
await classCard.getByRole('button', { name: /modifier/i }).click();
|
||||
await expect(page).toHaveURL(/\/admin\/classes\/[\w-]+/);
|
||||
|
||||
@@ -168,13 +176,13 @@ test.describe('Admin Class Detail Page [P1]', () => {
|
||||
|
||||
// Go back to list and verify the new name appears (use search for pagination)
|
||||
await page.goto(`${ALPHA_URL}/admin/classes`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
const searchInput = page.locator('input[type="search"]');
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill(newName);
|
||||
await page.waitForTimeout(500);
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
await expect(page.getByText(newName)).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.getByText(newName)).toBeVisible({ timeout: 15000 });
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
@@ -233,8 +241,16 @@ test.describe('Admin Class Detail Page [P1]', () => {
|
||||
await page.getByRole('button', { name: /créer la classe/i }).click();
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Search for the newly created class to handle pagination
|
||||
const searchCancel = page.locator('input[type="search"]');
|
||||
if (await searchCancel.isVisible()) {
|
||||
await searchCancel.fill(originalName);
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
// Navigate to edit page
|
||||
const classCard = page.locator('.class-card', { hasText: originalName });
|
||||
await expect(classCard).toBeVisible({ timeout: 15000 });
|
||||
await classCard.getByRole('button', { name: /modifier/i }).click();
|
||||
await expect(page).toHaveURL(/\/admin\/classes\/[\w-]+/);
|
||||
|
||||
@@ -246,10 +262,17 @@ test.describe('Admin Class Detail Page [P1]', () => {
|
||||
await page.getByRole('button', { name: /annuler/i }).click();
|
||||
|
||||
// Should go back to the classes list
|
||||
await expect(page).toHaveURL(/\/admin\/classes$/);
|
||||
await expect(page).toHaveURL(/\/admin\/classes$/, { timeout: 10000 });
|
||||
|
||||
// Search for the class to handle pagination
|
||||
const searchAfterCancel = page.locator('input[type="search"]');
|
||||
if (await searchAfterCancel.isVisible()) {
|
||||
await searchAfterCancel.fill(originalName);
|
||||
await page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
// The original name should still be visible, modified name should not
|
||||
await expect(page.getByText(originalName)).toBeVisible();
|
||||
await expect(page.getByText(originalName)).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.getByText('Should-Not-Persist')).not.toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user