Skip to content

Commit

Permalink
refacto: renommage d'un paramètre
Browse files Browse the repository at this point in the history
pour mieux différencier la chaine servant de clef pour une instance EtapeCSRD
et l'instance d'EtapeCSRD elle-même.
  • Loading branch information
sblondon committed Nov 12, 2024
1 parent 398e548 commit 457742c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions impact/reglementations/tests/test_csrd_reglementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ def test_calcule_etat_si_non_soumis(entreprise_factory, alice):
"reglementations:gestion_csrd",
kwargs={
"siren": entreprise.siren,
"etape": "introduction",
"id_etape": "introduction",
},
)

Expand Down Expand Up @@ -1284,7 +1284,7 @@ def test_calcule_etat_si_soumis_en_2025_et_delegable(entreprise_factory, alice):
"reglementations:gestion_csrd",
kwargs={
"siren": entreprise.siren,
"etape": "introduction",
"id_etape": "introduction",
},
)

Expand Down Expand Up @@ -1319,7 +1319,7 @@ def test_calcule_etat_si_soumis_en_2027_et_non_delegable(entreprise_factory, ali
"reglementations:gestion_csrd",
kwargs={
"siren": entreprise.siren,
"etape": "introduction",
"id_etape": "introduction",
},
)

Expand Down Expand Up @@ -2174,7 +2174,7 @@ def test_calcule_etat_avec_CSRD_initialisée(entreprise_factory, alice):
"reglementations:gestion_csrd",
kwargs={
"siren": entreprise.siren,
"etape": "introduction",
"id_etape": "introduction",
},
)

Expand Down Expand Up @@ -2207,7 +2207,7 @@ def test_calcule_etat_avec_CSRD_et_étapes_validées(entreprise_factory, alice):
"reglementations:gestion_csrd",
kwargs={
"siren": entreprise.siren,
"etape": "analyse-materialite",
"id_etape": "analyse-materialite",
},
)

Expand Down
2 changes: 1 addition & 1 deletion impact/reglementations/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
name="csrd_sous_etape",
),
path(
"csrd/<str:siren>/etape-<str:etape>",
"csrd/<str:siren>/etape-<str:id_etape>",
views.csrd.gestion_csrd,
name="gestion_csrd",
),
Expand Down
12 changes: 6 additions & 6 deletions impact/reglementations/views/csrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def calculate_status(
"reglementations:gestion_csrd",
kwargs={
"siren": caracteristiques.entreprise.siren,
"etape": etape_suivante,
"id_etape": etape_suivante,
},
),
label_gestion_csrd,
Expand Down Expand Up @@ -518,7 +518,7 @@ def guide_csrd(request, siren=None, phase=0, etape=0, sous_etape=0):


@login_required
def gestion_csrd(request, siren=None, etape="introduction"):
def gestion_csrd(request, siren=None, id_etape="introduction"):
if not siren:
entreprise = get_current_entreprise(request)
if not entreprise:
Expand All @@ -533,7 +533,7 @@ def gestion_csrd(request, siren=None, etape="introduction"):
if not is_user_attached_to_entreprise(request.user, entreprise):
raise PermissionDenied

template_name = f"reglementations/csrd/etape-{etape}.html"
template_name = f"reglementations/csrd/etape-{id_etape}.html"
try:
template = get_template(template_name)
except TemplateDoesNotExist as e:
Expand All @@ -551,9 +551,9 @@ def gestion_csrd(request, siren=None, etape="introduction"):
csrd = rapport_csrd(request.user, entreprise, annee)
if not csrd:
raise Http404
csrd.etape_validee = EtapeCSRD.id_precedent(etape)
csrd.etape_validee = EtapeCSRD.id_precedent(id_etape)
csrd.save()
redirect("reglementations:gestion_csrd", siren=siren, etape=etape)
redirect("reglementations:gestion_csrd", siren=siren, id_etape=id_etape)

# les prefetch de l'enjeu parent évitent des N+1 au niveau du template
csrd, _ = RapportCSRD.objects.prefetch_related(
Expand All @@ -566,7 +566,7 @@ def gestion_csrd(request, siren=None, etape="introduction"):

context = {
"entreprise": entreprise,
"etape": EtapeCSRD.get(etape),
"etape": EtapeCSRD.get(id_etape),
"csrd": csrd,
"annee": annee,
"steps": ETAPES_CSRD,
Expand Down

0 comments on commit 457742c

Please sign in to comment.