# MCT — Modele Conceptuel de Traitements > Vue dynamique des operations metier. Complete le MCD (statique) et les state diagrams (cycles de vie). > Methodologie : Merise. Chaque operation = evenement declencheur + regle de synchronisation + actions + evenement resultat. ## 1. Conventions - **Evenement** : un fait survenant dans le systeme, declenche une operation. Note `EV-XX`. - **Operation** : traitement metier qui transforme un etat. Note `OP-XX`. - **Regle de synchronisation** : condition logique sur les evenements entrants (AND/OR). - **Regle d'emission** : condition sur les evenements de sortie selon le resultat. ## 2. Liste des evenements | Code | Evenement | Origine | |------|-----------|---------| | EV-01 | Demande creation formation | Admin | | EV-02 | Specs blocs renseignees | Admin | | EV-03 | Specs modules renseignees | Admin | | EV-04 | Demande attribution module | Admin | | EV-05 | Formateur dispo (capacite >= heures requises) | System (calcul) | | EV-06 | Date debut module atteinte | System (cron) | | EV-07 | Saisie heures realisees | Formateur | | EV-08 | Date fin module atteinte | System (cron) | | EV-09 | Demande annulation attribution | Admin | | EV-10 | Rollup recalcule | System (auto) | | EV-11 | Capacite formateur depassee | System (calcul) | | EV-12 | Demande archivage formation | Admin | | EV-13 | Tous modules d'une formation realises | System (calcul) | | EV-14 | Demande edition page wiki | Admin / Formateur | | EV-15 | Lien partage cree | Admin | ## 3. Liste des operations | Code | Operation | Acteur principal | |------|-----------|------------------| | OP-01 | Creer une formation | Admin | | OP-02 | Decomposer en blocs et modules | Admin | | OP-03 | Attribuer un module a un formateur | Admin | | OP-04 | Saisir heures realisees | Formateur | | OP-05 | Annuler une attribution | Admin | | OP-06 | Cloturer un module | System / Admin | | OP-07 | Cloturer une formation | System / Admin | | OP-08 | Recalculer rollups | System (auto) | | OP-09 | Notifier depassement capacite | System (auto) | | OP-10 | Archiver une formation | Admin | | OP-11 | Generer rapport formation | Admin | | OP-12 | Generer rapport formateur | Admin | | OP-13 | Inviter client par lien partage | Admin | | OP-14 | Backup quotidien | System (cron) | ## 4. Operations detaillees ### OP-01 — Creer une formation ```mermaid flowchart TD EV01([EV-01 Demande creation formation]) --> SYNC1{Regle sync:
EV-01 saisi} SYNC1 --> OP01[OP-01 Creer formation] OP01 -->|Validation OK| EV_OUT_OK([EV: Formation creee statut=draft]) OP01 -->|Nom deja existant| EV_OUT_ERR([EV: Erreur saisie]) ``` - **Entrants** : EV-01 - **Synchro** : EV-01 saisi - **Actions** : 1. Valider unicite du nom 2. Valider `heures_totales > 0` 3. INSERT formation avec `statut = draft`, timestamps auto - **Sortants** : - Si OK → "Formation creee" (statut = draft) - Si erreur → "Erreur saisie" ### OP-03 — Attribuer un module a un formateur ```mermaid flowchart TD EV04([EV-04 Demande attribution]) --> SYNC2{AND} EV05([EV-05 Formateur dispo]) --> SYNC2 SYNC2 --> OP03[OP-03 Creer attribution] OP03 -->|RG-01 OK| EV_ATTR([EV: Attribution creee statut=planifie]) OP03 -->|RG-01 KO| EV_BLOCK([EV: Erreur depassement heures module]) EV_ATTR --> OP08_TRIG[Trigger OP-08 Recalculer rollups] ``` - **Entrants** : EV-04 AND EV-05 - **Synchro** : les deux evenements presents (formateur dispo verifie avant ouverture du formulaire) - **Actions** : 1. Valider RG-01 : `SUM(attributions.heures) + nouvelle_attribution.heures <= module.heures_prevues` 2. Valider RG-02 : warning si `formateur.heures_attribuees + nouvelle.heures > formateur.capacite` (mais pas blocage) 3. INSERT attribution avec `statut = planifie` 4. Declenche EV-10 (rollup recalcule) - **Sortants** : - Si OK → "Attribution creee" + EV-10 - Si RG-01 KO → "Erreur depassement" - Si RG-02 warning → "Attribution creee" + "Warning capacite" ### OP-04 — Saisir heures realisees - **Entrants** : EV-07 (saisie formateur) - **Synchro** : EV-07 ET attribution.statut IN (`planifie`, `en_cours`) - **Actions** : 1. Valider RG-05 : `heures_realisees <= heures_attribuees + tolerance` 2. UPDATE attribution.heures_realisees 3. Si `heures_realisees == heures_attribuees` → attribution.statut = `realise` 4. Declenche EV-10 (rollup recalcule) - **Sortants** : "Heures saisies" + EV-10. Si RG-05 KO → "Erreur depassement heures" ### OP-06 — Cloturer un module - **Entrants** : EV-08 OR EV-13 - **Synchro** : - EV-08 (date fin atteinte) ET `module.statut = en_cours` - OU manuel admin via bouton "Marquer realise" - **Actions** : 1. Verifier : toutes attributions du module en `realise` ou `annule` 2. UPDATE module.statut = `realise` 3. Si tous les modules de la formation = `realise` → declenche EV-13 - **Sortants** : "Module cloture" ### OP-07 — Cloturer une formation - **Entrants** : EV-13 (tous modules realises) ET formation.date_fin atteinte - **Synchro** : AND des deux - **Actions** : UPDATE formation.statut = `termine` - **Sortants** : "Formation terminee" ### OP-08 — Recalculer rollups - **Entrants** : EV-10 (toute modification de attribution, module, bloc, formation) - **Actions** : 1. Recalcul cascadant : attribution → module → bloc → formation 2. Recalcul formateur.heures_attribuees / heures_restantes 3. Si formateur.heures_restantes < 0 → declenche EV-11 - **Sortants** : "Rollups a jour" + EV-11 si depassement ### OP-09 — Notifier depassement capacite - **Entrants** : EV-11 - **Actions** : 1. Identifier admins du workspace 2. Envoyer notification (email + dans-app) avec details - **Sortants** : "Notification envoyee" ## 5. Diagramme global du flux ```mermaid flowchart TD EV01([EV-01]) --> OP01[OP-01 Creer formation] OP01 --> EV02_PRE([Formation creee]) EV02_PRE --> OP02[OP-02 Decomposer en blocs/modules] OP02 --> EV_MOD([Modules crees a_attribuer]) EV_MOD --> OP03[OP-03 Attribuer module] OP03 --> EV_ATTR_OK([Attribution planifie]) EV_ATTR_OK --> OP08[OP-08 Recalcul rollups] EV06([EV-06 Date debut]) --> EV_EN_COURS([Module en_cours]) EV_EN_COURS --> OP04[OP-04 Saisie heures realisees] OP04 --> OP08 OP04 --> EV_REAL([Module realise]) EV_REAL --> OP06[OP-06 Cloturer module] OP06 --> EV13([EV-13 Tous modules realises]) EV13 --> OP07[OP-07 Cloturer formation] OP07 --> EV_TERM([Formation terminee]) OP08 --> EV11{Capacite
depassee?} EV11 -->|Oui| OP09[OP-09 Notifier admin] ``` ## 6. Operations secondaires | Operation | Trigger | Frequence | |-----------|---------|-----------| | OP-11 Generer rapport formation | Demande admin | A la demande | | OP-12 Generer rapport formateur | Demande admin | A la demande | | OP-13 Inviter client | Demande admin | A la demande | | OP-14 Backup | Cron quotidien | 1x/jour | ## 7. Operations Agence (extension scope B) | Code | Operation | Acteur principal | Trigger | |------|-----------|------------------|---------| | OPA-01 | Creer client | Admin | Manuel | | OPA-02 | Creer projet | Admin | Devis signe | | OPA-03 | Decomposer projet en taches | Admin | Apres creation projet | | OPA-04 | Attribuer tache a un developpeur | Admin | Manuel | | OPA-05 | Saisir intervention | Developpeur | Apres travail effectue | | OPA-06 | Marquer tache `done` | Developpeur ou Admin | Validation | | OPA-07 | Cloturer projet | Admin | Toutes taches done + livraison validee | | OPA-08 | Recalculer rollups Agence | System | Sur evenement (intervention modifiee) | | OPA-09 | Lier projet a formation pedagogique | Admin | Optionnel, sur fiche projet | | OPA-10 | Recalculer capacite Personne (formation + agence) | System | Sur evenement (attribution OU intervention modifiee) | ### OPA-05 — Saisir intervention (developpeur) - **Entrants** : Developpeur ouvre l'app + selectionne tache - **Synchro** : Personne.roles contient `developpeur` ET tache.statut != `abandoned/done` - **Actions** : 1. Valider `intervention_heures > 0` 2. INSERT intervention statut `realise` 3. Declenche OPA-08 + OPA-10 (recalcul rollups) - **Sortants** : "Intervention saisie" + "Rollups a jour" ### OPA-10 — Recalculer capacite Personne unifiee C'est une evolution de l'OP-08 du MCT initial. Maintenant que Personne pivot existe : ``` Personne.heures_attribuees_formation = SUM(ATTRIBUTION.heures_attribuees) WHERE personne ET statut != annule Personne.heures_attribuees_agence = SUM(INTERVENTION.heures) WHERE personne ET statut != annule Personne.heures_restantes_total = capacite_annuelle - heures_attribuees_formation - heures_attribuees_agence ``` Si `heures_restantes_total < 0` → declenche notification depassement (OP-09 etendu pour capacite totale). ## 8. Questions ouvertes (a valider en MOT) - [ ] OP-04 (saisie heures) : declenchee quand par le formateur ? En fin de session ? En fin de mois ? - [ ] OP-06/OP-07 : cloture automatique a la date fin OU manuelle apres validation admin ? - [ ] OP-09 (notification depassement) : warning soft ou blocage dur ? Email + Slack/Teams ? - [ ] OP-11/OP-12 (rapports) : format PDF, CSV, Excel ? Push vers comptabilite ? - [ ] OP-08 (rollups) : tolerance de delai acceptable ? Eventual consistency OK ou TR strict ?