Skip to content

Commit

Permalink
(surveys) suggest dora searches on cats
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Mar 11, 2024
1 parent 4b0802b commit 6a2aa3c
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lacommunaute/surveys/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class DSPAdmin(admin.ModelAdmin):

@admin.register(Recommendation)
class RecommendationAdmin(admin.ModelAdmin):
list_display = ("category", "text")
list_display = ("category", "text", "dora_cats")
1 change: 1 addition & 0 deletions lacommunaute/surveys/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def create_recommendations(*args, **kwargs):
codename=codename,
category=spec["category"],
text=spec["text"],
dora_cats=spec.get("dora_cats"),
)
)
Recommendation.objects.bulk_create(recommendations, ignore_conflicts=True)
Expand Down
17 changes: 17 additions & 0 deletions lacommunaute/surveys/migrations/0004_recommendation_dora_cats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.2 on 2024-02-29 16:17

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("surveys", "0003_dsp_city_code_dsp_latitude_dsp_location_and_more"),
]

operations = [
migrations.AddField(
model_name="recommendation",
name="dora_cats",
field=models.CharField(blank=True, editable=False, max_length=100, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.2 on 2024-02-29 16:27

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("surveys", "0004_recommendation_dora_cats"),
]

operations = [
migrations.AlterField(
model_name="recommendation",
name="dora_cats",
field=models.CharField(blank=True, max_length=100, null=True),
),
]
1 change: 1 addition & 0 deletions lacommunaute/surveys/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Recommendation(models.Model):
codename = models.CharField(editable=False, max_length=100, unique=True)
category = models.CharField(editable=False, max_length=100)
text = models.TextField()
dora_cats = models.CharField(max_length=100, null=True, blank=True)

def __str__(self):
return f"[{self.category}] {self.text}"
Expand Down
8 changes: 8 additions & 0 deletions lacommunaute/surveys/recommendations.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ text = "Vérifier la continuité des droits et assurer un suivi administratif"
codename = "mobilite-0"
category = "Mobilité"
text = "Mise en place d'un accompagnement pour apprendre à utiliser les transports en commun ou d’une formation à la conduite"
dora_cats = "mobilite"

[[recommendations]]
codename = "mobilite-1"
category = "Mobilité"
text = "Aide pour la mise en règle des documents du véhicule et sensibilisation à l'importance de l'assurance et du contrôle technique"
dora_cats = "mobilite"

[[recommendations]]
codename = "mobilite-2"
Expand All @@ -98,21 +100,25 @@ text = """
Évaluer les besoins de mobilité spécifiques liés à la garde des enfants et \
au travail possibilité de mise en place de mobilité solidaire\
"""
dora_cats = "mobilite"

[[recommendations]]
codename = "mobilite-3"
category = "Mobilité"
text = "Encourager l’usage du covoiturage, valoriser la mobilité dans la recherche d’emploi"
dora_cats = "mobilite"

[[recommendations]]
codename = "ressources-0"
category = "Situation financière"
text = "Evaluer et lister le niveau d’endettement"
dora_cats = "gestion-financiere"

[[recommendations]]
codename = "ressources-1"
category = "Situation financière"
text = "Suivi du dossier de surendettement et accompagnement vers une gestion budgétaire saine"
dora_cats = "gestion-financiere"

[[recommendations]]
codename = "ressources-2"
Expand All @@ -121,11 +127,13 @@ text = """
Accompagnement en gestion budgétaire, orientation vers des aides financières et \
des conseils en économie sociale et familiale\
"""
dora_cats = "gestion-financiere"

[[recommendations]]
codename = "ressources-3"
category = "Situation financière"
text = "Ateliers de gestion budgétaire avancée si nécessaire"
dora_cats = "gestion-financiere"

[[recommendations]]
codename = "judiciaire-0"
Expand Down
14 changes: 13 additions & 1 deletion lacommunaute/templates/surveys/dsp_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,19 @@ <h2>Général</h2>
<div>
<h2 class="h3">{{ category }}</h2>
<ul>
{% for recommendation in recommendations %}<li>{{ recommendation.text }}</li>{% endfor %}
{% for recommendation in recommendations %}
<p>{{ recommendation.text }}</p>
{% if recommendation.dora_cats %}
<p>
<a href="https://dora.inclusion.beta.gouv.fr/recherche/?city={{ object.city_code }}&cats={{ recommendation.dora_cats }}&cl={{ object.location }}&lat={{ object.latitude }}&lon={{ object.longitude }}#utm=communaute"
class="btn btn-outline-primary matomo-event"
target="_blank"
data-matomo-category="engagement"
data-matomo-action="dsp"
data-matomo-option="visit-dora-{{ category }}">Découvrez les services sur le thème {{ category }} dans Dora</a>
</p>
{% endif %}
{% endfor %}
</ul>
{% if not forloop.last %}<hr>{% endif %}
</div>
Expand Down

0 comments on commit 6a2aa3c

Please sign in to comment.