Skip to content

Commit

Permalink
feat(Entreprises): nouveau champ pour stocker le nombre d'acheteurs s…
Browse files Browse the repository at this point in the history
…ur LinkedIn (#1140)
  • Loading branch information
raphodn authored Mar 22, 2024
1 parent 2e358ba commit 1fd1fc3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lemarche/companies/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class CompanyAdmin(admin.ModelAdmin, DynamicArrayMixin):
},
),
("Logo", {"fields": ("logo_url", "logo_url_display")}),
("Utilisateurs", {"fields": ("user_count_annotated_with_link",)}),
("Besoins", {"fields": ("user_tender_count_annotated_with_link",)}),
("LinkedIn", {"fields": ("linkedin_buyer_count",)}),
("Impact", {"fields": ("user_count_annotated_with_link", "user_tender_count_annotated_with_link")}),
("Dates", {"fields": ("created_at", "updated_at")}),
)

Expand Down
35 changes: 35 additions & 0 deletions lemarche/companies/migrations/0005_company_linkedin_buyer_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 4.2.9 on 2024-03-22 08:54

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("companies", "0004_company_user_tender_count"),
]

operations = [
migrations.AddField(
model_name="company",
name="linkedin_buyer_count",
field=models.IntegerField(
default=0, help_text="Champ renseigné par un ADMIN", verbose_name="Nombre d'acheteurs sur LinkedIn"
),
),
migrations.AlterField(
model_name="company",
name="user_count",
field=models.IntegerField(
default=0, help_text="Champ recalculé à intervalles réguliers", verbose_name="Nombre d'utilisateurs"
),
),
migrations.AlterField(
model_name="company",
name="user_tender_count",
field=models.IntegerField(
default=0,
help_text="Champ recalculé à intervalles réguliers",
verbose_name="Nombre de besoins déposés par les utilisateurs",
),
),
]
11 changes: 9 additions & 2 deletions lemarche/companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from django.utils import timezone
from django_better_admin_arrayfield.models.fields import ArrayField

from lemarche.utils.constants import ADMIN_FIELD_HELP_TEXT, RECALCULATED_FIELD_HELP_TEXT


class CompanyQuerySet(models.QuerySet):
def has_user(self):
Expand Down Expand Up @@ -39,8 +41,13 @@ class Company(models.Model):
)

# stats
user_count = models.IntegerField("Nombre d'utilisateurs", default=0)
user_tender_count = models.IntegerField("Nombre de besoins déposés par les utilisateurs", default=0)
linkedin_buyer_count = models.IntegerField(
"Nombre d'acheteurs sur LinkedIn", help_text=ADMIN_FIELD_HELP_TEXT, default=0
)
user_count = models.IntegerField("Nombre d'utilisateurs", help_text=RECALCULATED_FIELD_HELP_TEXT, default=0)
user_tender_count = models.IntegerField(
"Nombre de besoins déposés par les utilisateurs", help_text=RECALCULATED_FIELD_HELP_TEXT, default=0
)

created_at = models.DateTimeField(verbose_name="Date de création", default=timezone.now)
updated_at = models.DateTimeField(verbose_name="Date de modification", auto_now=True)
Expand Down

0 comments on commit 1fd1fc3

Please sign in to comment.