diff --git a/openfisca_france_local/communes/antony/antony_aide_depart_sejour_adapte.py b/openfisca_france_local/communes/antony/antony_aide_depart_sejour_adapte.py index bf52c18b..74a3d629 100644 --- a/openfisca_france_local/communes/antony/antony_aide_depart_sejour_adapte.py +++ b/openfisca_france_local/communes/antony/antony_aide_depart_sejour_adapte.py @@ -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, diff --git a/openfisca_france_local/communes/antony/base_ressources.py b/openfisca_france_local/communes/antony/base_ressources.py index c883221d..ed6788b1 100644 --- a/openfisca_france_local/communes/antony/base_ressources.py +++ b/openfisca_france_local/communes/antony/base_ressources.py @@ -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 @@ -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 @@ -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