Skip to content

Commit

Permalink
Revert "Rename POPULAR_THRESHOLD to OVERWHELMED_THRESHOLD"
Browse files Browse the repository at this point in the history
This reverts commit 10ce331.
  • Loading branch information
dejafait committed Jan 13, 2025
1 parent 10ce331 commit 33b7ceb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions itou/companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def with_annotation_is_popular(self):
}
annotation = self.with_job_applications_count(filters=job_apps_filters).annotate(
is_popular=Case(
When(job_applications_count__gte=self.model.OVERWHELMED_THRESHOLD, then=True),
When(job_applications_count__gte=self.model.POPULAR_THRESHOLD, then=True),
default=False,
output_field=BooleanField(),
)
Expand Down Expand Up @@ -604,7 +604,7 @@ class JobDescription(models.Model):
"""

MAX_UI_RANK = 32767
OVERWHELMED_THRESHOLD = 20
POPULAR_THRESHOLD = 20
# Max number or workable hours per week in France (Code du Travail)
MAX_WORKED_HOURS_PER_WEEK = 48

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{% if job_description.is_popular %}
<span class="badge badge-sm rounded-pill bg-accent-03 text-primary">
<i class="ri-group-line me-1" aria-hidden="true"></i>
{{ job_description.OVERWHELMED_THRESHOLD }}+<span class="ms-1">candidatures</span>
{{ job_description.POPULAR_THRESHOLD }}+<span class="ms-1">candidatures</span>
</span>
{% endif %}
<ul class="c-box--results__list-contact flex-md-grow-1 mt-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% if job.is_popular %}
<span class="badge badge-sm rounded-pill bg-accent-03 text-primary">
<i class="ri-group-line me-1" aria-hidden="true"></i>
{{ job.OVERWHELMED_THRESHOLD }}+<span class="ms-1">candidatures</span>
{{ job.POPULAR_THRESHOLD }}+<span class="ms-1">candidatures</span>
</span>
{% endif %}
<p class="fs-sm mb-0 mt-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% endif %}
{% if job.is_popular %}
<div class="order-1 order-md-2">
<span class="badge badge-sm rounded-pill bg-accent-03 text-primary ms-0 ms-lg-2 mt-1 mt-lg-0"><i class="ri-group-line"></i>{{ job.OVERWHELMED_THRESHOLD }}+ candidatures</span>
<span class="badge badge-sm rounded-pill bg-accent-03 text-primary ms-0 ms-lg-2 mt-1 mt-lg-0"><i class="ri-group-line"></i>{{ job.POPULAR_THRESHOLD }}+ candidatures</span>
</div>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion itou/www/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_results_page_and_counts(self, siaes, job_descriptions):
)
for job_description in page.object_list:
job_description.is_popular = (
len(job_description.jobapplication_set_pending) >= job_description._meta.model.OVERWHELMED_THRESHOLD
len(job_description.jobapplication_set_pending) >= job_description._meta.model.POPULAR_THRESHOLD
)
return PageAndCounts(
results_page=page,
Expand Down
4 changes: 2 additions & 2 deletions tests/companies/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def test_with_annotation_is_popular(self):

# Test popular threshold: popular job description
popular_job_description = siae_job_descriptions[0]
for _ in range(JobDescription.OVERWHELMED_THRESHOLD + 1):
for _ in range(JobDescription.POPULAR_THRESHOLD + 1):
JobApplicationFactory(to_company=company, selected_jobs=[popular_job_description], job_seeker=job_seeker)

assert JobDescription.objects.with_annotation_is_popular().get(pk=popular_job_description.pk).is_popular
Expand All @@ -372,7 +372,7 @@ def test_with_annotation_is_popular(self):
# Popular job descriptions count related **pending** job applications.
# They should ignore other states.
job_description = siae_job_descriptions[2]
threshold_exceeded = JobDescription.OVERWHELMED_THRESHOLD + 1
threshold_exceeded = JobDescription.POPULAR_THRESHOLD + 1

JobApplicationFactory.create_batch(
threshold_exceeded,
Expand Down

0 comments on commit 33b7ceb

Please sign in to comment.