Skip to content

Commit

Permalink
job_description_search: Simplify sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
dejafait committed Jan 6, 2025
1 parent d9e6c33 commit cfdfb46
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions itou/templates/search/includes/siaes_search_top.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ <h3 class="modal-title" id="jobDescriptionsSortingTipModalLabel">Comment sont tr
<p class="fw-bold">Pour les résultats des postes ouverts au recrutement, l’ordre de priorité est le suivant&nbsp;:</p>
<ol>
<li>Les postes des emplois de l’inclusion</li>
<li>Les postes mis à jour récemment</li>
<li>Les postes créés récemment</li>
<li>Les postes mis à jour ou créés récemment</li>
</ol>
</div>
<div class="modal-footer">
Expand Down
4 changes: 1 addition & 3 deletions itou/www/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ def add_form_choices(self, form, siaes):
pass

def get_results_page_and_counts(self, siaes, job_descriptions):
job_descriptions = job_descriptions.order_by(
F("source_kind").asc(nulls_first=True), "-updated_at", "-created_at"
)
job_descriptions = job_descriptions.order_by(F("source_kind").asc(nulls_first=True), "-updated_at")

page = pager(job_descriptions, self.request.GET.get("page"), items_per_page=10)
# Prefer a prefetch_related over annotating the entire queryset with_annotation_is_popular().
Expand Down
6 changes: 2 additions & 4 deletions tests/www/search/__snapshots__/tests.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@
AND "companies_company"."is_searchable"
AND NOT ("companies_company"."block_job_applications"))
ORDER BY "companies_jobdescription"."source_kind" ASC NULLS FIRST,
"companies_jobdescription"."updated_at" DESC,
"companies_jobdescription"."created_at" DESC
"companies_jobdescription"."updated_at" DESC
LIMIT 1
''',
}),
Expand Down Expand Up @@ -502,8 +501,7 @@
AND "companies_company"."is_searchable"
AND NOT ("companies_company"."block_job_applications"))
ORDER BY "companies_jobdescription"."source_kind" ASC NULLS FIRST,
"companies_jobdescription"."updated_at" DESC,
"companies_jobdescription"."created_at" DESC
"companies_jobdescription"."updated_at" DESC
LIMIT 1
''',
}),
Expand Down

0 comments on commit cfdfb46

Please sign in to comment.