diff --git a/backend/core/helpers.py b/backend/core/helpers.py index 08d8dfdf2..b53c312e7 100644 --- a/backend/core/helpers.py +++ b/backend/core/helpers.py @@ -15,6 +15,9 @@ from iam.models import Folder, Permission, RoleAssignment, User from library.helpers import get_referential_translation +from statistics import mean +import math + from .models import * from .utils import camel_case @@ -889,6 +892,10 @@ def viewable_items(model): viewable_controls = viewable_items(AppliedControl) controls_count = viewable_controls.count() + progress_avg = math.ceil( + mean([x.progress() for x in viewable_items(ComplianceAssessment)] or [0]) + ) + data = { "controls": { "total": controls_count, @@ -908,17 +915,19 @@ def viewable_items(model): "acceptances": viewable_items(RiskAcceptance).count(), }, "compliance": { + "used_frameworks": viewable_items(ComplianceAssessment) + .values("framework_id") + .distinct() + .count(), "audits": viewable_items(ComplianceAssessment).count(), "active_audits": viewable_items(ComplianceAssessment) .filter(status__in=["in_progress", "in_review", "done"]) .count(), "evidences": viewable_items(Evidence).count(), - "compliant_items": viewable_items(RequirementAssessment) - .filter(result="compliant") - .count(), "non_compliant_items": viewable_items(RequirementAssessment) .filter(result="non_compliant") .count(), + "progress_avg": progress_avg, }, "audits_stats": build_audits_stats(user), "csf_functions": csf_functions(user), diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 42a0fa288..08e008306 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -808,14 +808,15 @@ "sumpageToDo": "to do", "sumpageInProgress": "in progress", "sumpageOnHold": "on hold", - "sumpageActiveAudits": "active audits", - "sumpageCompliantItems": "compliant items", - "sumpageNonCompliantItems": "non compliant items", - "sumpageEvidences": "evidences", - "sumpageAssessments": "assessments", - "sumpageScenarios": "scenarios", - "sumpageMappedThreats": "mapped threats", - "sumpageRiskAccepted": "risks accepted", + "sumpageActiveAudits": "Active audits", + "sumpageCompliantItems": "Compliant items", + "sumpageNonCompliantItems": "Non compliant items", + "sumpageEvidences": "Evidences", + "sumpageAvgProgress": "Average progress", + "sumpageAssessments": "Assessments", + "sumpageScenarios": "Scenarios", + "sumpageMappedThreats": "Mapped threats", + "sumpageRiskAccepted": "Risks accepted", "sumpageSectionControls": "controls", "sumpageTitleComplianceOverview": "Compliance overview", "sumpageTitleCurrentRisks": "Current risks", diff --git a/frontend/messages/fr.json b/frontend/messages/fr.json index dbe72b3a1..4b6a31d9f 100644 --- a/frontend/messages/fr.json +++ b/frontend/messages/fr.json @@ -791,21 +791,22 @@ "fillSSOSLOURLx509cert": "Option 2 : Remplissez l'URL SSO, l'URL SLO et le certificat x509", "licenseAboutToExpireWarning": "Il reste {days_left} jours avant l'expiration de votre licence.", "noExpirationDateSet": "Aucune date d'expiration définie", - "sumpageTotal": "total", - "sumpageActive": "actif", - "sumpageDeprecated": "obsolète", - "sumpageToDo": "à faire", - "sumpageInProgress": "en cours", - "sumpageOnHold": "en attente", - "sumpageActiveAudits": "audits actifs", - "sumpageCompliantItems": "items conformes", - "sumpageNonCompliantItems": "items non conformes", - "sumpageEvidences": "preuves", - "sumpageAssessments": "évaluations", - "sumpageScenarios": "scénarios", - "sumpageMappedThreats": "menaces mappées", - "sumpageRiskAccepted": "risques acceptés", - "sumpageSectionControls": "mesures", + "sumpageTotal": "Total", + "sumpageActive": "Actif", + "sumpageDeprecated": "Obsolète", + "sumpageToDo": "A faire", + "sumpageInProgress": "En cours", + "sumpageOnHold": "En attente", + "sumpageActiveAudits": "Audits actifs", + "sumpageCompliantItems": "Exigences conformes", + "sumpageNonCompliantItems": "Exigences non conformes", + "sumpageEvidences": "Preuves", + "sumpageAvgProgress": "Avancement moyenné", + "sumpageAssessments": "Analyses", + "sumpageScenarios": "Scénarios", + "sumpageMappedThreats": "Menaces mappées", + "sumpageRiskAccepted": "Risques acceptés", + "sumpageSectionControls": "Mesures", "sumpageTitleComplianceOverview": "Aperçu conformité", "sumpageTitleCurrentRisks": "Risques actuels", "sumpageTitleResidualRisks": "Risques résiduels", diff --git a/frontend/src/lib/components/DataViz/Card.svelte b/frontend/src/lib/components/DataViz/Card.svelte index e2c7818eb..277b88ed8 100644 --- a/frontend/src/lib/components/DataViz/Card.svelte +++ b/frontend/src/lib/components/DataViz/Card.svelte @@ -1,7 +1,7 @@ -
{count}