Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommandations #512

Merged
merged 6 commits into from
Feb 8, 2024
Merged

Recommandations #512

merged 6 commits into from
Feb 8, 2024

Conversation

francoisfreitag
Copy link
Contributor

@francoisfreitag francoisfreitag commented Jan 23, 2024

Description

Recommander des actions suite au diagnostic parcours IAE. Pour le moment, simplissime : une réponse correspond à une recommendations.

Gestion des accès avec la permission surveys.add_dsp

TODO

  • Ajuster le texte des recommendations (Vincent et Sihame)
  • Ajouter des liens Tally (Vincent)
  • Message de commit (François)

Closes #511

@francoisfreitag francoisfreitag force-pushed the ff/surveys branch 7 times, most recently from 8885c1f to 457a398 Compare January 25, 2024 10:40
@francoisfreitag
Copy link
Contributor Author

@vincentporte Voilà un début de système de recommendations (complètement inutiles 🙈).
Je n’ai rien testé en dehors de mon navigateur, car nous ne savons pas trop quoi en faire. Une fois qu’on connaîtra l’attendu, on solidifiera l’implémentation avec des tests.

Par rapport à la version initiale :

  • les choix ont été déplacés du formulaire vers le modèle, pour faciliter l’affichage du template sans formulaire, et la réutilisation en général
  • ajout d’un système de recommendation en format fichier plat (TOML), et synchronisation vers la base de données. Si une modif est faite dans l’admin django, elle sera préservée tant que le codename existe.

@francoisfreitag francoisfreitag force-pushed the ff/surveys branch 4 times, most recently from 89f652d to f8c04d3 Compare January 29, 2024 16:39
@francoisfreitag francoisfreitag marked this pull request as ready for review January 31, 2024 09:43
@francoisfreitag
Copy link
Contributor Author

On merge “en l’état” et on itère : https://mattermost.incubateur.net/betagouv/pl/dtgkutcrg38qj8yxb7tjeyiewa

@francoisfreitag francoisfreitag force-pushed the ff/surveys branch 2 times, most recently from 909bdc1 to 17a2b3a Compare January 31, 2024 10:00
francoisfreitag and others added 3 commits February 8, 2024 11:57
The eventual goal is to make recommendations for DORA services. For the
first iteration, it simply outputs some text to guide professionals on
the next action.

The first version is extremely crude, so it’s untested, as most
expectations are unknown.
@vincentporte vincentporte added the python Pull requests that update Python code label Feb 8, 2024
@vincentporte vincentporte force-pushed the ff/surveys branch 2 times, most recently from 69a0a8a to ff759e5 Compare February 8, 2024 11:14
Comment on lines 31 to 38
assertContains(response, '<iframe data-tally-src="https://tally.so/embed')
assertNotContains(response, '<form method="post">')

def test_user_has_permission(self, db, client):
client.force_login(UserFactory(with_perm=[Permission.objects.get(codename="add_dsp")]))
response = client.get(reverse("surveys:dsp_create"))
assertContains(response, '<form method="post">')
assertNotContains(response, '<iframe data-tally-src="https://tally.so/embed')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour éviter que ces assertions assertNotContains ne tombent en désuetudes, on peut utiliser un attribut sur la classe.

Exemple :

form_html = '<form method="post">'
tally_html = '<iframe data-tally-src="https://tally.so/embed'

def test_user_has_no_permission(self, db, client):
    # ...
    assertContains(response, self.tally_html)
    assertNotContains(response, self.form_html)

def test_user_has_permission(self, db, client):
    # ...
    assertContains(response, self.form_html)
    assertNotContains(response, self.tally_html)

Copy link
Contributor Author

@francoisfreitag francoisfreitag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça m’a l’air OK :)

Copy link
Contributor

@vincentporte vincentporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✋🏿 collaborative work 🎸

@vincentporte vincentporte merged commit eb0e62b into master Feb 8, 2024
4 checks passed
@vincentporte vincentporte deleted the ff/surveys branch February 8, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DSP] Moteur de recommandations
2 participants