Browse Source

fix: nuil properties when creating a new activity

lairaalmas 1 year ago
parent
commit
e326db5ed7
2 changed files with 14 additions and 14 deletions
  1. 9 8
      js/menus/menu_main.js
  2. 5 6
      js/moodle/integrationFunctions.js

+ 9 - 8
js/menus/menu_main.js

@@ -25,15 +25,16 @@ const menuState = {
       }
     } else {
       // FOR MOODLE
-      if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'true')
+      if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'true') {
         playerName = game.lang.professor;
-
-      // reset game values
-      gameId = null;
-      gameMode = null;
-      gameOperation = null;
-      gameDifficulty = null;
-      showFractions = true;
+      } else {
+        // reset game values
+        gameId = null;
+        gameMode = null;
+        gameOperation = null;
+        gameDifficulty = null;
+        showFractions = true;
+      }
 
       renderBackground();
 

+ 5 - 6
js/moodle/integrationFunctions.js

@@ -50,10 +50,10 @@ function getAnswer() {
       gameOperation +
       '\ngameDifficulty:' +
       gameDifficulty +
-      '\nshowFractions:' +
-      showFractions +
       '\ngameId:' +
       gameId +
+      '\nshowFractions:' +
+      showFractions +
       '\nresults:';
     for (let i = 0; i < moodleVar.hits.length; i++) {
       str +=
@@ -88,10 +88,10 @@ function getAnswer() {
       gameOperation +
       '\ngameDifficulty:' +
       gameDifficulty +
-      '\nshowFractions:' +
-      showFractions +
       '\ngameId:' +
-      gameId;
+      gameId +
+      '\nshowFractions:' +
+      showFractions;
   }
 
   return str;
@@ -264,7 +264,6 @@ const updateGlobalVariables = function (infoGame, infoResults) {
         gameId = 0;
     }
   }
-
   gameShape = infoGame['gameShape'];
   gameMode = infoGame['gameMode'];
   gameOperation = infoGame['gameOperation'];