Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWDK update & generation support #56

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
8 changes: 4 additions & 4 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -32,4 +32,4 @@ jobs:
file: build/_output/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file_glob: true
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ 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
- run: yarn install
- run: yarn test-ci
- run: yarn build
- run: yarn build
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"version": "1.3.3",
"dependencies": {
"hammerjs": "2.0.6",
"materia-widget-development-kit": "2.5.2"
"materia-widget-development-kit": "~3.0.2"
},
"scripts": {
"start": "webpack-dev-server",
"build": "webpack -p",
"build-dev": "webpack",
"start": "mwdk-start",
"build": "mwdk-build-prod",
"build-dev": "mwdk-build-dev",
"test": "TZ='America/New_York' jest --verbose",
"test-ci": "TZ='America/New_York' CI=true jest --ci --useStderr --coverage --coverageReporters text-summary cobertura"
},
Expand Down
1 change: 1 addition & 0 deletions sample_score_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"overview":{"complete":"1","score":95.45454545454545,"table":[{"message":"Points Lost","value":-4.545454545454544},{"message":"Final Score","value":95.45454545454545}],"referrer_url":"","created_at":1698246741,"auth":""},"details":[{"title":"Responses:","header":["Question Score","The Question","Your Response","Correct Answer"],"table":[{"data":["The tallest mountain in the world, and the ultimate challenge for mountain climbers everywhere.","everest","Everest"],"data_style":["question","response","answer"],"score":100,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"full-value","tag":"div","symbol":"%","graphic":"score","display_score":true},{"data":["A white marble mausoleum commissioned in 1632 by an emperor to house the tomb of his favorite wife of three.","the taj-mahal","The Taj-Mahal"],"data_style":["question","response","answer"],"score":100,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"full-value","tag":"div","symbol":"%","graphic":"score","display_score":true},{"data":["Home for the president of the United States of America.","the white house","The White House"],"data_style":["question","response","answer"],"score":100,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"full-value","tag":"div","symbol":"%","graphic":"score","display_score":true},{"data":["Mysterious landmark of several large standing stones arranged in a circle.","stonehenge","Stonehenge"],"data_style":["question","response","answer"],"score":100,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"full-value","tag":"div","symbol":"%","graphic":"score","display_score":true},{"data":["This is one of the world\u0027s oldest statues - A lion with a human head that stands in the Giza Plateau.","sphinx","Sphinx"],"data_style":["question","response","answer"],"score":100,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"full-value","tag":"div","symbol":"%","graphic":"score","display_score":true},{"data":["A monument built for the 1889 World\u0027s Fair, this metal structure can be found on the Champ de Mars in Paris.","eiffel toads","Eiffel Tower"],"data_style":["question","response","answer"],"score":72.72727272727273,"feedback":null,"type":"SCORE_QUESTION_ANSWERED","style":"partial-value","tag":"div","symbol":"%","graphic":"score","display_score":true}]}]}]
4 changes: 2 additions & 2 deletions src/creator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ CrosswordCreator.controller 'crosswordCreatorCtrl', ['$scope', '$timeout', ($sco
_drawCurrentPuzzle _items
$scope.hasFreshPuzzle = true

$scope.onSaveClicked = ->
if not _buildSaveData()
$scope.onSaveClicked = (mode) ->
if not _buildSaveData() and mode isnt 'history'
return Materia.CreatorCore.cancelSave 'Required fields not filled out'
Materia.CreatorCore.save _title, _qset

Expand Down
6 changes: 6 additions & 0 deletions src/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ general:
is_qset_encrypted: Yes
is_answer_encrypted: Yes
is_storage_enabled: No
is_generable: Yes
api_version: 2
files:
creator: creator.html
Expand Down Expand Up @@ -38,3 +39,8 @@ meta_data:
accessibility_description: >
Includes custom controls that may override standard navigation.
These controls are communicated visually and to screenreaders.
generation_prompt: >
The resulting json object must contain an items array nested within a second items array within the qset->data object. The data object should
additionally contain an options key with two properties: freeWords and hintPenalty. The default values for these two properties are 1 and 50 respectively. The
hint value present in each question's options object should provide slightly more information or context to help students guess the associated word, and be more
substantive than simply offering the first letter.
5 changes: 4 additions & 1 deletion src/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const fs = require('fs')
const path = require('path')

describe('Player', function() {
require('angular/angular.js')
require('angular-mocks/angular-mocks.js')

var widgetInfo;
var qset;

Expand Down Expand Up @@ -30,7 +33,7 @@ describe('Player', function() {
widgetInfo = require('./demo.json');
qset = widgetInfo.qset;

require('../node_modules/materia-server-client-assets/src/js/materia-namespace');
require('../node_modules/materia-widget-dependencies/js/materia.js');
require('./player.coffee');
});

Expand Down
45 changes: 17 additions & 28 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,38 @@ const widgetWebpack = require('materia-widget-development-kit/webpack-widget')
const copy = widgetWebpack.getDefaultCopyList()

const outputPath = path.join(process.cwd(), 'build')
const srcPath = path.join(__dirname, 'src') + path.sep

const customCopy = copy.concat([
{
from: path.join(__dirname, 'node_modules', 'hammerjs', 'hammer.min.js'),
to: outputPath,
},
{
from: path.join(__dirname, 'src', '_guides', 'assets'),
from: path.join(srcPath, '_guides', 'assets'),
to: path.join(outputPath, 'guides', 'assets'),
toType: 'dir'
},
])

const entries = {
'creator.js': [
path.join(__dirname, 'src', 'print.coffee'),
path.join(__dirname, 'src', 'creator.puzzle.coffee'),
path.join(__dirname, 'src', 'creator.coffee')
'player': [
path.join(srcPath, 'player.html'),
path.join(srcPath, 'print.coffee'),
path.join(srcPath, 'player.coffee'),
path.join(srcPath, 'player.scss')
],
'player.js': [
path.join(__dirname, 'src', 'print.coffee'),
path.join(__dirname, 'src', 'player.coffee')
'creator': [
path.join(srcPath, 'creator.html'),
path.join(srcPath, 'print.coffee'),
path.join(srcPath, 'creator.coffee'),
path.join(srcPath, 'creator.puzzle.coffee'),
path.join(srcPath, 'creator.scss'),
],
'creator.css': [
path.join(__dirname, 'src', 'creator.html'),
path.join(__dirname, 'src', 'creator.scss')
],
'player.css': [
path.join(__dirname, 'src', 'player.html'),
path.join(__dirname, 'src', 'player.scss')
],
'scoreScreen.js': [
path.join(__dirname, 'src', 'scoreScreen.coffee')
],
'scoreScreen.css': [
path.join(__dirname, 'src', 'scoreScreen.html'),
path.join(__dirname, 'src', 'scoreScreen.scss')
],
'guides/player.temp.html': [
path.join(__dirname, 'src', '_guides', 'player.md')
],
'guides/creator.temp.html': [
path.join(__dirname, 'src', '_guides', 'creator.md')
'scoreScreen': [
path.join(srcPath, 'scoreScreen.html'),
path.join(srcPath, 'scoreScreen.coffee'),
path.join(srcPath, 'scoreScreen.scss')
]
}

Expand Down
Loading
Loading