Skip to content

Conversation

@tonial
Copy link
Contributor

@tonial tonial commented May 23, 2024

🤔 Pourquoi ?

Parce que ContractType.FIXED_TERM_I_PHC a pour valeur FED_TERM_I_PHC dans la base de données.
Peut-être devrait-on changer cette valeur en db avec une migration en plus de cette amélioration du code ?

cf sentry : https://itou.sentry.io/issues/5132982995/?project=6164438&query=is%3Aunresolved+level%3Aerror&referrer=issue-stream&statsPeriod=14d&stream_index=8

🍰 Comment ?

Décrivez en quelques mots la solution retenue et mise en oeuvre, les difficultés ou problèmes rencontrés. Attirez l'attention sur les décisions d'architecture ou de conception importantes.

💻 Captures d'écran

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?

🏝️ Comment tester

Les instructions pour reproduire le problème, les profils de test, le parcours spécifique à utiliser, etc. Si vous disposez d'une recette jetable, mettre l'URL pour tester dans cette partie.

@tonial tonial added the modifié Modifié dans le changelog. label May 23, 2024
@tonial tonial requested review from rsebille and xavfernandez May 23, 2024 13:33
@tonial tonial self-assigned this May 23, 2024
@tonial tonial force-pushed the alaurent/api branch 2 times, most recently from bf1b6a9 to 4c059df Compare May 23, 2024 13:45
Copy link
Member

@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.

Peut-être avec un test de non régression ?

@tonial tonial force-pushed the alaurent/api branch 2 times, most recently from 870287f to 1cbee0a Compare May 24, 2024 04:36
@tonial
Copy link
Contributor Author

tonial commented May 24, 2024

C'est fait !
J'en ai profité pour mettre à jour la DB aussi

@tonial tonial force-pushed the alaurent/api branch 2 times, most recently from 7f5d6fe to e68795c Compare May 24, 2024 06:05

def _fix_contract_type_enum(apps, schema_editor):
JobDescription = apps.get_model("companies", "JobDescription")
JobDescription.objects.filter(contract_type="FED_TERM_I_PHC").update(contract_type="FIXED_TERM_I_PHC")
Copy link
Contributor

Choose a reason for hiding this comment

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

Il faudrait voir avec le pilotage qui récupère cette donnée:

{
"name": "type_contrat",
"type": "varchar",
"comment": "Type de contrat proposé",
"fn": lambda o: o.contract_type,
},

Quitte à leur mettre une rustine temporaire pour leur re-transformer FIXED_TERM_I_PHC en FED_TERM_I_PHC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je les ai prévenu.

tonial added 2 commits May 24, 2024 09:40
Because ContractType FIXED_TERM_I_PHC is stored as FED_TERM_I_PHC in the
database....

Next commit will fix the value in the enum + database
@tonial tonial added this pull request to the merge queue May 24, 2024
Merged via the queue into master with commit ab0cbb0 May 24, 2024
@tonial tonial deleted the alaurent/api branch May 24, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifié Modifié dans le changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants