Skip to content

Commit

Permalink
Rename QS filter method
Browse files Browse the repository at this point in the history
  • Loading branch information
tut-tuuut committed Jan 24, 2025
1 parent 930d889 commit 10baa1b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gsl_programmation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def add_enveloppe_projets_to_simulation(simulation_id):
selected_projets = Projet.objects.for_perimetre(simulation_perimetre).filter(
dossier_ds__demande_dispositif_sollicite=simulation_dotation
)
selected_projets = selected_projets.keep_only_projet_to_deal_with_this_year()
selected_projets = selected_projets.to_deal_with_this_year()

for projet in selected_projets:
asked_amount = projet.dossier_ds.demande_montant or 0
Expand Down
2 changes: 1 addition & 1 deletion gsl_projet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def for_perimetre(self, perimetre: Perimetre | None):
if perimetre.region:
return self.filter(demandeur__departement__region=perimetre.region)

def keep_only_projet_to_deal_with_this_year(self):
def to_deal_with_this_year(self):
return self.filter(
Q(
dossier_ds__ds_state__in=[
Expand Down
4 changes: 2 additions & 2 deletions gsl_projet/tests/test_model_projet.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_keep_only_projet_to_deal_with_this_year_with_projet_to_display(
)

qs = Projet.objects.all()
qs = qs.keep_only_projet_to_deal_with_this_year()
qs = qs.to_deal_with_this_year()

assert qs.count() == 1

Expand Down Expand Up @@ -197,6 +197,6 @@ def test_keep_only_projet_to_deal_with_this_year_with_projet_to_archive(
),
)

qs = Projet.objects.keep_only_projet_to_deal_with_this_year()
qs = Projet.objects.to_deal_with_this_year()

assert qs.count() == 0
2 changes: 1 addition & 1 deletion gsl_projet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_context_data(self, **kwargs):

def get_queryset(self):
qs = Projet.objects.for_user(self.request.user)
qs = qs.keep_only_projet_to_deal_with_this_year()
qs = qs.to_deal_with_this_year()
qs = ProjetService.add_filters_to_projets_qs(qs, self.request.GET)
qs = ProjetService.add_ordering_to_projets_qs(qs, self.request.GET.get("tri"))
return qs

0 comments on commit 10baa1b

Please sign in to comment.