Skip to content

Commit

Permalink
Modifie les ressources prises en compte pour comparaison avec les 3 d…
Browse files Browse the repository at this point in the history
…erniers mois
  • Loading branch information
frtomas authored and Shamzic committed Nov 6, 2024
1 parent 9fa65f1 commit f020961
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ class antony_aide_depart_sejour_adapte_montant_individuel(Variable):
def formula(famille, period, parameters):
parameters_antony = parameters(period).communes.antony.plafonds_revenus.sejour_adapte

ressources_famille = famille('antony_base_ressources', period)
# Les plafonds sont mensuels et les ressources sont considérées sur 3 mois
# On remet donc les ressources à un niveau mensuel pour la comparaison
ressources_considerees_famille = famille('antony_base_ressources', period) / 3

montant = select(
[
ressources_famille < parameters_antony.tranches.tranche_1,
ressources_famille < parameters_antony.tranches.tranche_2
ressources_considerees_famille < parameters_antony.tranches.tranche_1,
ressources_considerees_famille < parameters_antony.tranches.tranche_2
],
[
parameters_antony.montants.montant_tranche_1,
Expand Down
35 changes: 10 additions & 25 deletions openfisca_france_local/communes/antony/base_ressources.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ def formula(famille, period, parameters):
'ppa'
]

# This is a comment
ressources_famille_annuelles_a_inclure = [
'ars'
]

resources_mensuelles_individus_m_3 = sum([
famille.members(resource, last_three_months, options=[ADD])
for resource in ressources_individus_a_inclure
Expand All @@ -50,25 +45,13 @@ def formula(famille, period, parameters):
])
ressources_m_3 = ressources_mensuelles_famille_m_3 + famille.sum(resources_mensuelles_individus_m_3)

resources_mensuelles_individus_n_1 = sum([
famille.members(resource, last_year, options=[ADD])
for resource in ressources_individus_a_inclure
])
ressources_mensuelles_famille_n_1 = sum([
famille(resource, last_year, options=[ADD])
for resource in ressources_famille_a_inclure
])
ressources_annuelles_famille_n_1 = sum([
famille(resource, last_year)
for resource in ressources_famille_annuelles_a_inclure
])
ressources_n_1 = (famille.sum((resources_mensuelles_individus_n_1 / 4))
+ (ressources_mensuelles_famille_n_1 / 4)
+ (ressources_annuelles_famille_n_1 / 4)
)
# on ne compare les ressources recentes avec le N-1
# que si on a effectivement des ressources N-1
ressources_considerees = where(ressources_n_1 > 0, min_(ressources_m_3, ressources_n_1), ressources_m_3)
rfr_equivalent_m_3 = famille.demandeur.foyer_fiscal('rfr', period.n_2) / 4

ressources_considerees = select(
[((ressources_m_3 > 0) * (rfr_equivalent_m_3 > 0)), (ressources_m_3 > 0), (rfr_equivalent_m_3 > 0)],
[min_(ressources_m_3, rfr_equivalent_m_3), ressources_m_3, rfr_equivalent_m_3],
default=0
)

return ressources_considerees

Expand Down Expand Up @@ -96,4 +79,6 @@ def formula(famille, period, parameters):
[parameters_antony.personne_seule, parameters_antony.couple, baremes_enfants.calc(min_(nb_enfants, 7))]
)

return ressources_considerees < plafond_considere
# Les plafonds sont mensuels et les ressources sont considérées sur 3 mois
# On remet donc les ressources à un niveau mensuel pour la comparaison
return (ressources_considerees / 3) < plafond_considere

0 comments on commit f020961

Please sign in to comment.