-
Notifications
You must be signed in to change notification settings - Fork 56
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
[TECH] Refacto des badges des certifications complémentaires (PIX-9862) #7447
[TECH] Refacto des badges des certifications complémentaires (PIX-9862) #7447
Conversation
Une fois les applications déployées, elles seront accessibles via les liens suivants : Les variables d'environnement seront accessibles via les liens suivants : |
3afbf90
to
b8d9468
Compare
9c4f665
to
ee19ef6
Compare
a6fff66
to
46c15ce
Compare
eb52bc9
to
f396d3c
Compare
@@ -13,7 +13,7 @@ const register = async function (server) { | |||
payload: Joi.object({ | |||
data: { | |||
attributes: { | |||
juryLevel: Joi.string().required(), | |||
juryLevel: Joi.required(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Pourquoi le jury level peut être désormais un id ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La reponse est vaguement dans les remarque de PR.
Les resultats de certifs comp stockent maintenant non plus une clé de badge mais un id.
On remplace donc ici aussi. On aurait pu choisir de garder la key (mais ca aurait ete un peu etrange), de prendre le level justement (mais il faudrait ensuite retrouver le bon id derriere) ou bien de prendre cet id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Du coup je comprends mieux mais ça serait peut être mieux de renommer la variable, juryLevel
en juryLevelComplementaryCertificationBadgeId
ou juryComplementaryCertificationBadgeId
maintenant
Je propose de
|
f396d3c
to
d6a0ece
Compare
Ajout d'un commit pour ajouter un check joi sur le format du JuryLevel |
fac0ad8
to
c9ee2b0
Compare
Vu ensemble: on ne supprime pas la colonne partnerKey de complementary-certification-course-results ici. |
api/tests/integration/infrastructure/repositories/jury-certification-repository_test.js
Show resolved
Hide resolved
api/lib/infrastructure/repositories/certification-result-repository.js
Outdated
Show resolved
Hide resolved
.withKeyName('cccresults-ccbadgeId_foreignkey'); | ||
}); | ||
|
||
await knex(TABLE_NAME).update({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas trop d'inquiétude à se faire niveau perf de cette migration ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a moins de 3000 lignes à mettre à jour, c'est OK
identifiersType.complementaryCertificationBadgeId, | ||
Joi.string().valid(juryOptions.REJECTED).valid(juryOptions.UNSET), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah oui le juryLevel ça peut soit être un id soit une string dans le cas d'un jury échoué ou en attente ?
static buildFromJuryLevel({ complementaryCertificationCourseId, juryLevel, pixPartnerKey }) { | ||
if (juryLevel === juryOptions.REJECTED) { | ||
static buildFromJuryLevel({ complementaryCertificationCourseId, complementaryCertificationBadgeId, juryLevel }) { | ||
if (juryLevel === 'REJECTED') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question : Je ne sais pas dans quel contexte on se trouve ici mais il n'y a pas un risque d'avoir un juryLevel à UNSET ici et qu'il finisse à la ligne 42 ?
@@ -71,7 +71,7 @@ export { getPrivateCertificate, findPrivateCertificatesByUserId, getShareableCer | |||
async function _getCertifiedBadges(certificationCourseId) { | |||
const complementaryCertificationCourseResults = await knex | |||
.select( | |||
'complementary-certification-course-results.partnerKey', | |||
'badges.key as partnerKey', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
histoire d'être iso avec le nom de colonne de cette table, mais ça suggère plus de changement dans le code
'badges.key as partnerKey', | |
'badges.key as key', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai pas osé (pour limiter les changements effectivement)
Je suis pas sur pour la proposition du |
c9ee2b0
to
de707e7
Compare
86a621b
to
bb29a09
Compare
bb29a09
to
9bade71
Compare
9bade71
to
caafd89
Compare
🦄 Problème
La table complementary-certification-course-results stocke la clé (partner key) du badge acquis. Ce n’est pas une clé étrangère et ne permet pas de faire aisaiment des jointure. Globalement cela prête à confusion
🤖 Proposition
Supprimer la colonne partnerKey qui se refere au champs key de la table badge et la remplacer par une jointure vers la table complementary-certification-badges
🌈 Remarques
Le juryLevel envoyé par le front pour mettre à jour le resultat du jury passe d'une clé (CLEA) a un ID (10002). Je n'ai pas renommé le champs. ca peut se discuter
La PR est tres grosse, elle pourrait etre decoupée mais ca necessiterais de faire plus de tests func...
💯 Pour tester
S'assurer que l'on voit bien l'obtention des certifs coté admin et coté user
Ce cas est passé sur la session suivante: https://admin-pr7447.review.pix.fr/sessions/1000015/certifications