Uploaded image for project: 'Offre de formation'
  1. Offre de formation
  2. ODF-2885

Migration pour ODF-2790 doit être automatisée

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • 4.4.0
    • 4.4.0
    • None
    • None
    • 4.4 RC3

      Pour l'issue ODF-2790, une procédure de migration de données a été écrite mais :

      • Elle pourrait être une migration automatique
      • Aucune migration de type "manual" n'y a été rattaché

      Le script suivant doit être retravaillé sachant que les "personnalisations" proviennent de la configuration générale (odf.programs.degree.license, odf.programs.degree.licensepro, odf.programs.degree.master) :

      // A PERSONNALISER en fonction de vos propres codes diplôme !!
      var codeLicence = "XA";
      var codeLicencePro = "DP";
      var codeMaster = "XB";
      
      var mapping = [];
      mapping[codeLicence] = "odf-enumeration.MentionLicence";
      mapping[codeLicencePro] = "odf-enumeration.MentionLicencepro";
      mapping[codeMaster] = "odf-enumeration.MentionMaster";
      
      function _addMentionType(degreeCode, mentionType)
      {
          function _setMentionType(content)
          {
              content.setValue("mentionType", mentionType);
              Ametys.console.info("Degree content with code " + degreeCode + " was linked to mention type " + mentionType);
          }
      
          Repository.query("//element(*, ametys:content)[@ametys-internal:contentType = 'odf-enumeration.Degree' and @ametys:code = '" + degreeCode + "']") 
              .forEach(function(content) 
              { 
                  Content.migrate( 
                      content, 
                      [_setMentionType], 
                      true, /* old version still comptatible */ 
                      null, /* no tag */ 
                      false, /* verbose */
                      true /* synchronize live */
                  ); 
              } 
          ); 
      }
      
      for (var degreeCode in mapping)
      {
          _addMentionType(degreeCode, mapping[degreeCode]);
      }

      Le script doit être suffisamment robuste si jamais la migration manuelle a déjà été faite ou si la configuration obsolète a déjà été supprimée.

          [ODF-2885] Migration pour ODF-2790 doit être automatisée

          Bérénice Maurel made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]
          Bérénice Maurel made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Ready to merge [ 10208 ] New: Resolved [ 5 ]
          Cédric Damioli made changes -
          Rank New: Ranked higher
          Cédric Damioli made changes -
          Sprint New: 4.4 RC3 [ 57 ]
          Cédric Damioli made changes -
          Sprint Original: 4.4 RC2 [ 56 ]
          Raphaël Franchet made changes -
          Assignee New: Bérénice Maurel [ bmaurel ]
          Raphaël Franchet made changes -
          Assignee Original: Raphaël Franchet [ raphael ]
          Raphaël Franchet made changes -
          Status Original: Functional review OK [ 10207 ] New: Ready to merge [ 10208 ]
          Bérénice Maurel made changes -
          Status Original: Available for review [ 10005 ] New: Functional review OK [ 10207 ]
          Bérénice Maurel made changes -
          Assignee Original: Bérénice Maurel [ bmaurel ] New: Raphaël Franchet [ raphael ]

            bmaurel Bérénice Maurel
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: