From e7334313031b5fc8d070199da4c01455c39bea66 Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Tue, 28 Nov 2023 10:20:57 +0100 Subject: [PATCH 1/5] feat(api): allow new training type --- api/src/devcomp/application/trainings/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/src/devcomp/application/trainings/index.js b/api/src/devcomp/application/trainings/index.js index db1cd128f1e..f27587e99e6 100644 --- a/api/src/devcomp/application/trainings/index.js +++ b/api/src/devcomp/application/trainings/index.js @@ -125,7 +125,9 @@ const register = async function (server) { hours: Joi.number().min(0).max(23).default(0), minutes: Joi.number().min(0).max(59).default(0), }).required(), - type: Joi.string().valid('autoformation', 'webinaire').required(), + type: Joi.string() + .valid('autoformation', 'e-learning', 'hybrid-training', 'in-person-training', 'webinaire') + .required(), locale: Joi.string().valid('fr-fr', 'fr', 'en-gb').required(), 'editor-name': Joi.string().required(), 'editor-logo-url': Joi.string().uri().required(), @@ -169,7 +171,9 @@ const register = async function (server) { hours: Joi.number().min(0).max(23).required(), minutes: Joi.number().min(0).max(59).required(), }).allow(null), - type: Joi.string().valid('autoformation', 'webinaire').allow(null), + type: Joi.string() + .valid('autoformation', 'e-learning', 'hybrid-training', 'in-person-training', 'webinaire') + .allow(null), locale: Joi.string().valid('fr-fr', 'fr', 'en-gb').allow(null), 'editor-name': Joi.string().allow(null), 'editor-logo-url': Joi.string().allow(null), From d317e9361d69ead88291e230d1a2777f3214c47b Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Tue, 28 Nov 2023 10:25:50 +0100 Subject: [PATCH 2/5] feat(admin): add new training type --- admin/app/models/training.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/app/models/training.js b/admin/app/models/training.js index 1bc55d1e258..39f882c69e0 100644 --- a/admin/app/models/training.js +++ b/admin/app/models/training.js @@ -5,6 +5,9 @@ import { memberAction } from 'ember-api-actions'; export const typeCategories = { webinaire: 'Webinaire', autoformation: "Parcours d'autoformation", + 'e-learning': 'Formation en ligne', + 'hybrid-training': 'Formation hybride', + 'in-person-training': 'Formation en présentiel', }; export const optionsTypeList = formatList(typeCategories); From b0837ddb70d1d0f94fb5a6471a6ab67b4c27d285 Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Tue, 28 Nov 2023 10:34:19 +0100 Subject: [PATCH 3/5] feat(app): add translation for new training type --- mon-pix/translations/en.json | 3 +++ mon-pix/translations/fr.json | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mon-pix/translations/en.json b/mon-pix/translations/en.json index 6962f7a20cf..f670d0c2f34 100644 --- a/mon-pix/translations/en.json +++ b/mon-pix/translations/en.json @@ -1510,6 +1510,9 @@ "editor": "Training provided by", "type": { "autoformation": "Autoformation course", + "e-learning": "E-Learning", + "hybrid-training": "Hybrid training", + "in-person-training": "In person training", "webinaire": "Webinar" } }, diff --git a/mon-pix/translations/fr.json b/mon-pix/translations/fr.json index 2cad7478d45..247524ca569 100644 --- a/mon-pix/translations/fr.json +++ b/mon-pix/translations/fr.json @@ -1510,6 +1510,9 @@ "editor": "Contenu formatif proposé par", "type": { "autoformation": "Parcours d'autoformation", + "e-learning": "Formation à distance", + "hybrid-training": "Formation hybride", + "in-person-training": "Formation en présentiel", "webinaire": "Webinaire" } }, From 97b8ad9b732087d7b67f5f5deffdb32cfd24d5ef Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Wed, 29 Nov 2023 14:47:59 +0100 Subject: [PATCH 4/5] sr(seed): fix case in training type --- api/db/seeds/data/team-contenu/data-builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/db/seeds/data/team-contenu/data-builder.js b/api/db/seeds/data/team-contenu/data-builder.js index 9585b15826d..aa82a1f50a0 100644 --- a/api/db/seeds/data/team-contenu/data-builder.js +++ b/api/db/seeds/data/team-contenu/data-builder.js @@ -343,7 +343,7 @@ async function _createTraining(databaseBuilder) { trainingId: TEAM_CONTENU_OFFSET_ID, title: 'Contenu formatif / équipe contenu', link: 'https://www.youtube.com/watch?v=qq09UkPRdFY', - type: 'Webinaire', + type: 'webinaire', duration: '00:04:08', locale: 'fr-fr', editorName: 'Mariah Carey', From 202388b1d16178d053f7fe0f9021c07324851b0f Mon Sep 17 00:00:00 2001 From: Vincent Hardouin Date: Wed, 29 Nov 2023 14:51:56 +0100 Subject: [PATCH 5/5] sr(admin): fix case in training type --- .../trainings/create-or-update-training-form_test.js | 2 +- .../components/trainings/training-details-card_test.js | 4 ++-- .../unit/controllers/authenticated/trainings/new_test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/tests/integration/components/trainings/create-or-update-training-form_test.js b/admin/tests/integration/components/trainings/create-or-update-training-form_test.js index a6b16a3191b..53521e50580 100644 --- a/admin/tests/integration/components/trainings/create-or-update-training-form_test.js +++ b/admin/tests/integration/components/trainings/create-or-update-training-form_test.js @@ -17,7 +17,7 @@ module('Integration | Component | Trainings::CreateOrUpdateTrainingForm', functi form = { title: 'Un contenu formatif', link: 'https://un-contenu-formatif', - type: 'Webinaire', + type: 'webinaire', locale: 'fr-fr', editorName: 'Un éditeur de contenu formatif', editorLogoUrl: 'un-logo.svg', diff --git a/admin/tests/integration/components/trainings/training-details-card_test.js b/admin/tests/integration/components/trainings/training-details-card_test.js index 9fa07741f60..b81afa8dce4 100644 --- a/admin/tests/integration/components/trainings/training-details-card_test.js +++ b/admin/tests/integration/components/trainings/training-details-card_test.js @@ -10,7 +10,7 @@ module('Integration | Component | Trainings::TrainingDetailsCard', function (hoo this.set('training', { title: 'Un contenu formatif', link: 'https://un-contenu-formatif', - type: 'Webinaire', + type: 'webinaire', locale: 'fr-fr', editorName: 'Un éditeur de contenu formatif', editorLogoUrl: 'un-logo.svg', @@ -28,7 +28,7 @@ module('Integration | Component | Trainings::TrainingDetailsCard', function (hoo // then assert.dom(screen.getByText('Un contenu formatif')).exists(); assert.dom(screen.getByText('https://un-contenu-formatif')).exists(); - assert.dom(screen.getByText('Webinaire')).exists(); + assert.dom(screen.getByText('webinaire')).exists(); assert.dom(screen.getByText('2j')).exists(); assert.dom(screen.getByText('Franco-français (fr-fr)')).exists(); assert.dom(screen.getByText('Un éditeur de contenu formatif')).exists(); diff --git a/admin/tests/unit/controllers/authenticated/trainings/new_test.js b/admin/tests/unit/controllers/authenticated/trainings/new_test.js index 168d3fe7dd2..5965ab9ecb9 100644 --- a/admin/tests/unit/controllers/authenticated/trainings/new_test.js +++ b/admin/tests/unit/controllers/authenticated/trainings/new_test.js @@ -27,7 +27,7 @@ module('Unit | Controller | authenticated/trainings/new', function (hooks) { id: 3, title: 'Ma formation', link: 'https://mon-lien', - type: 'Webinaire', + type: 'webinaire', locale: 'fr-fr', editorLogoUrl: 'https//images.fr/mon-logo.svg', editorName: 'Un éditeur de contenu formatif',