diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index a09e8f0..40ea059 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -11,14 +11,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [18.13.0] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Test and build with node ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -31,5 +31,5 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/_output/* tag: ${{ github.ref }} - overwrite: false + overwrite: true file_glob: true \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8d8d42..7165c1e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,14 +6,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.3.1, 12.x] + node-version: [18.13.0] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run tests with Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm install -g yarn diff --git a/package.json b/package.json index d38023c..5beb48f 100644 --- a/package.json +++ b/package.json @@ -5,22 +5,18 @@ }, "version": "1.2.0", "scripts": { - "start": "webpack-dev-server", - "build": "webpack -p", - "build-dev": "webpack", + "start": "mwdk-start", + "build": "mwdk-build-prod", + "build-dev": "mwdk-build-dev", "test": "echo 'tests not implemented'", "test-ci": "echo 'tests not implemented'" }, "devDependencies": { - "materia-widget-development-kit": "2.5.2" + "materia-widget-development-kit": "~3.0.0" }, "dependencies": { - "@babel/preset-react": "^7.16.0", "createjs": "1.0.0", - "hammerjs": "1.0.5", - "modernizr-webpack-plugin": "^1.0.7", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "hammerjs": "1.0.5" }, "license": "AGPL-3.0", "description": "Guess the Phrase is a guessing game played by guessing letters in a word using the provided clues.", diff --git a/src/_score/score_module.php b/src/_score/score_module.php index 1b94949..dea1d8b 100755 --- a/src/_score/score_module.php +++ b/src/_score/score_module.php @@ -8,9 +8,6 @@ class Score_Modules_Hangman extends Score_Module public function check_answer($log) { - // get qset once for options - if (empty($this->inst->qset)) $this->inst->get_qset($this->inst->id); - $wrong_limit = $this->inst->qset->data['options']['attempts']; $is_partial = $this->inst->qset->data['options']['partial']; diff --git a/src/assets/img/materia-logo.svg b/src/assets/img/materia-logo.svg new file mode 100644 index 0000000..4536229 --- /dev/null +++ b/src/assets/img/materia-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/materialogo.png b/src/assets/materialogo.png deleted file mode 100644 index 9e04bde..0000000 Binary files a/src/assets/materialogo.png and /dev/null differ diff --git a/src/creator.coffee b/src/creator.coffee index 4260b4e..847be2d 100755 --- a/src/creator.coffee +++ b/src/creator.coffee @@ -28,7 +28,7 @@ Hangman.directive('focusMe', ['$timeout', '$parse', ($timeout, $parse) -> ]) Hangman.factory 'Resource', ['$sanitize', ($sanitize) -> - buildQset: (title, items, partial, attempts, random) -> + buildQset: (title, items, partial, attempts, random, enableQuestionBank, questionBankVal) -> qsetItems = [] qset = {} @@ -47,7 +47,7 @@ Hangman.factory 'Resource', ['$sanitize', ($sanitize) -> Materia.CreatorCore.cancelSave 'Word #'+(i+1)+' needs to contain at least one letter or number.' return false - qset.options = {partial: partial, attempts: attempts, random: random} + qset.options = {partial: partial, attempts: attempts, random: random, enableQuestionBank: enableQuestionBank, questionBankVal: questionBankVal} qset.assets = [] qset.rand = false qset.name = title @@ -97,6 +97,10 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re $scope.partial = false $scope.random = false $scope.attempts = 5 + $scope.questionBankModal = false + $scope.enableQuestionBank = false + $scope.questionBankVal = 1 + $scope.questionBankValTemp = 1 # for use with paginating results $scope.currentPage = 0; @@ -191,7 +195,12 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re $scope.hideCover() $scope.hideCover = -> - $scope.showTitleDialog = $scope.showIntroDialog = false + $scope.showTitleDialog = $scope.showIntroDialog = $scope.questionBankModal = false + $scope.questionBankValTemp = $scope.questionBankVal + + $scope.validateQuestionBankVal = -> + if ($scope.questionBankValTemp >= 1 && $scope.questionBankValTemp <= $scope.items.length) + $scope.questionBankVal = $scope.questionBankValTemp $scope.initNewWidget = (widget, baseUrl) -> $scope.$apply -> @@ -202,12 +211,16 @@ Hangman.controller 'HangmanCreatorCtrl', ['$timeout', '$scope', '$sanitize', 'Re $scope.attempts = ~~qset.options.attempts or 5 $scope.partial = qset.options.partial $scope.random = qset.options.random + $scope.enableQuestionBank = if qset.options.enableQuestionBank then qset.options.enableQuestionBank else false + $scope.questionBankVal = if qset.options.questionBankVal then qset.options.questionBankVal else 1 + $scope.questionBankValTemp = if qset.options.questionBankVal then qset.options.questionBankVal else 1 + $scope.onQuestionImportComplete qset.items[0].items $scope.$apply() $scope.onSaveClicked = (mode = 'save') -> - qset = Resource.buildQset $sanitize($scope.title), $scope.items, $scope.partial, $scope.attempts, $scope.random + qset = Resource.buildQset $sanitize($scope.title), $scope.items, $scope.partial, $scope.attempts, $scope.random, $scope.enableQuestionBank, $scope.questionBankVal if qset then Materia.CreatorCore.save $sanitize($scope.title), qset $scope.onSaveComplete = (title, widget, qset, version) -> true diff --git a/src/creator.html b/src/creator.html index b19b59c..f2af374 100644 --- a/src/creator.html +++ b/src/creator.html @@ -12,11 +12,10 @@ - - - - - + + + + @@ -52,25 +51,43 @@
Randomize Order
- - + + ++ If Question Bank is on then the check to randomize order is disabled. This is because the question bank + randomizes the question order already. +
+Partial scoring
-- If partial scoring is on then students will receive credit equal to the percentage of the phrase they reveal. - When off students will receive a 100% if they guess the phrase correctly and a 0% otherwise. -
-- If the student doesn't reveal the phrase after the number of allowed incorrect guesses they move on to the next phrase. -
++ If partial scoring is on then students will receive credit equal to the percentage of the phrase they reveal. + When off students will receive a 100% if they guess the phrase correctly and a 0% otherwise. +
++ If the student doesn't reveal the phrase after the number of allowed incorrect guesses they move on to the next phrase. +
+When the question bank is enabled, the widget can use a subset of phrases to create a randomized and unique experience every time the student hits play.
+