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

refactor: use the new refactored migrateSituation from @publicodes/tools #577

Merged
merged 7 commits into from
Jun 18, 2024

Conversation

EmileRolley
Copy link
Contributor

@EmileRolley EmileRolley commented Jun 3, 2024

This PR is the follow-up to the migration module refactoring from @publicodes/tools done in publicodes/tools#43 (the release must be done before being able to merge).

Important

I quickly tested by artificially adding keys to the model's migration instructions and looking the situation in the local storage. Is there a more precise test protocol?

Changelog

  • Use the new migrateSituation API.
  • Use the Migration type provided by @publicodes/tools instead of the MigrationType.
  • Use the Situation type provided by publicodes.
  • Remove the unused publicodes-state/helpers/migration code.

@EmileRolley EmileRolley added the ✨ enhancement New feature or request label Jun 3, 2024
Copy link

vercel bot commented Jun 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nosgestesclimat ✅ Ready (Inspect) Visit Preview Jun 18, 2024 9:31am

@EmileRolley EmileRolley marked this pull request as draft June 3, 2024 08:43
@EmileRolley EmileRolley removed the request for review from florianpanchout June 3, 2024 08:43
Copy link

github-actions bot commented Jun 3, 2024

Report for the pull request #577


🌐 Translation status

UI's texts

Language Nb. missing translations Status
en
Missing 2 UI texts ⬇️
    Plus de 40 acteurs relaient <2>ou</2> ont relayé Nos Gestes Climat à travers <4>l’intégration du calculateur</4> sur leur site internet <8>ou</8> sa diffusion via <11>des campagnes</11> (mail, réseaux sociaux et/ou affichage). C’est majoritairement grâce à eux que nous sensibilisons près de 2 000 nouvelles personnes en moyenne chaque jour et nous les en remercions.,Plus de 40 acteurs relaient <2>ou</2> ont relayé Nos Gestes Climat à travers <4>l’intégration du calculateur</4> sur leur site internet <8>ou</8> sa diffusion via <11>des campagnes</11> (mail, réseaux sociaux et/ou affichage). C’est majoritairement grâce à eux que nous sensibilisons près de 2 000 nouvelles personnes en moyenne chaque jour et nous les en remercions. Un grand-père et sa petite-fille au cinéma, mangeant du pop-corn.,Un grand-père et sa petite-fille au cinéma, mangeant du pop-corn.
es
Missing 2 UI texts ⬇️
    Plus de 40 acteurs relaient <2>ou</2> ont relayé Nos Gestes Climat à travers <4>l’intégration du calculateur</4> sur leur site internet <8>ou</8> sa diffusion via <11>des campagnes</11> (mail, réseaux sociaux et/ou affichage). C’est majoritairement grâce à eux que nous sensibilisons près de 2 000 nouvelles personnes en moyenne chaque jour et nous les en remercions.,Plus de 40 acteurs relaient <2>ou</2> ont relayé Nos Gestes Climat à travers <4>l’intégration du calculateur</4> sur leur site internet <8>ou</8> sa diffusion via <11>des campagnes</11> (mail, réseaux sociaux et/ou affichage). C’est majoritairement grâce à eux que nous sensibilisons près de 2 000 nouvelles personnes en moyenne chaque jour et nous les en remercions. Un grand-père et sa petite-fille au cinéma, mangeant du pop-corn.,Un grand-père et sa petite-fille au cinéma, mangeant du pop-corn.

FAQ's questions

Language Nb. missing translations Status
en Ø ✔️
es Ø ✔️

You will find more information about the translation in the dedicated file.

@Clemog
Copy link
Contributor

Clemog commented Jun 3, 2024

I quickly tested by artificially adding keys to the model's migration instructions and looking the situation in the local storage. Is there a more precise test protocol?

Pour le moment, nous n'avons pas de tests unitaires sur NGC directement, en général, je teste avec différentes simulations, par exemple:


{
  "user": { "userId": "67f1b499-7511-4783-9d34-95bae1652c4e" },
  "tutorials": { "testIntro": true, "scoreExplanation": true },
  "simulations": [
    {
      "id": "cb6e9dba-0bfc-422d-8b61-73e5fd8a7723",
      "date": "2024-05-21T12:57:05.068Z",
      "situation": {
        "transport . voiture . km": {
          "valeur": 10000,
          "unité": "km"
        },
        "transport . voiture . kmsss": 10000,
        "transport . voiture . voyageurs": 5,
        "transport . voiture . utilisateur": "'régulier non propriétaire'",
        "transport . voiture . gabarit": "'SUV'",
        "alimentation . plats . viande 1 . nombre": 1,
        "alimentation . plats . viande 2 . nombre": 10,
        "alimentation . plats . poisson 1 . nombre": 2,
        "alimentation . plats . poisson 2 . nombre": 1,
        "alimentation . petit déjeuner . type": "'français'"
      },
      "foldedSteps": [
        "transport . voiture . kmsss",
        "transport . voiture . km",
        "transport . voiture . voyageurs",
        "transport . voiture . utilisateur",
        "transport . voiture . gabarit",
        "alimentation . plats . viande 1 . nombre",
        "alimentation . plats . viande 2 . nombre",
        "alimentation . plats . poisson 1 . nombre",
        "alimentation . plats . poisson 2 . nombre",
        "alimentation . petit déjeuner . type"
      ],
      "actionChoices": {},
      "computedResults": {
        "categories": {
          "transport": 2783.674198222813,
          "alimentation": 2071.4109821,
          "logement": 1477.82343812085,
          "divers": 1079.0454437235896,
          "services sociétaux": 1450.9052263863641
        },
        "bilan": 8862.859288553616
      },
      "progression": 0.08163265306122448
    }
  ],
  "currentSimulationId": "cb6e9dba-0bfc-422d-8b61-73e5fd8a7723"
}

@Clemog Clemog requested a review from florianpanchout June 3, 2024 12:23
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
Copy link
Contributor

Choose a reason for hiding this comment

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

pourquoi cette modif ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

J'avais des erreurs du LS en utilisant @publicodes/tools.

Copy link
Contributor

Choose a reason for hiding this comment

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

Je me demande si le problème ne devrait pas être réglé dans publicodes/tools plutôt qu'ici, tu crois pas ? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

bundler est la valeur par défaut d'une install create-next-app donc ça me va (j'ai une compréhension assez faible de ce que ça impacte)

@EmileRolley EmileRolley marked this pull request as ready for review June 3, 2024 20:02
Copy link

PR Emile

Copy link
Contributor

@florianpanchout florianpanchout left a comment

Choose a reason for hiding this comment

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

convertSimulation est nécessaire (il gère la migration de la reste de l'objet simulation). Par contre je vois qu'il n'était déjà plus appelé dans migrateSimulation

@EmileRolley
Copy link
Contributor Author

convertSimulation est nécessaire (il gère la migration de la reste de l'objet simulation). Par contre je vois qu'il n'était déjà plus appelé dans migrateSimulation.

Je ne trouve aucune occurrences de convertSimulation donc pour moi c'est pas utilisé.. Je te laisse corriger si il y a quelque chose de manquant.

@bjlaa bjlaa self-requested a review June 10, 2024 02:19
@Clemog Clemog merged commit 8cf5ced into preprod Jun 18, 2024
6 checks passed
@Clemog Clemog deleted the refactor-migration branch June 18, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants