mumuki-gobstones-runner 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d334d129610bab422ddf5f11b5dce55b87450d22917c70cc80562076e086f241
4
- data.tar.gz: 00d0fa88e016ea4a5afdf8e6108a911276252b4cc07fd39017326588e6d8376e
3
+ metadata.gz: 1e210e6371b549652dc5674fc497e318fef8e35ebe40475df597890eb8849415
4
+ data.tar.gz: 5114a8be2ba04408f937540d1162dcb1ab21751f315be62cf255b5a1a6e96cbc
5
5
  SHA512:
6
- metadata.gz: 790216f2e5a0a823eed7ea99996b953ed4a230938657c0445ba07d393a7de6f24b02a6abff3aa459e797326a5ba160c906c78daa788a61b7140e734f2e53b80a
7
- data.tar.gz: 32640cdaab617eedd40111b8a38bd96dd5c7ce2437e184018068d2c811b9e90412ce3adf3a70402fd56a1dbd1b92ce7941e7b70e7cb37eb876cda85a79e736f4
6
+ metadata.gz: c80289661f04949fc935516c9c9789881c1629b955d87cfe736ff4fed25afe92710706e1bea8c40bcbbbbe4a0c0995047e5287d2471f094ba7a08a830b41d316
7
+ data.tar.gz: 5fb6d3275bdf2cd8abf4a15426776d991059f439df46f517159d172d9638423b08051afb4c18298288b12fce510f6ab3545fcfe15833363cd6a7a58862be39ba
data/lib/checker.rb CHANGED
@@ -22,12 +22,18 @@ module Gobstones
22
22
  boards_match = board_json(expected_board).eql? board_json(actual_board)
23
23
  headers_match = expected_board[:head].eql?(actual_board[:head]) || !@options[:check_head_position]
24
24
 
25
- fail_with status: :check_final_board_failed_different_boards,
26
- result: {
27
- initial: result[:initialBoard],
28
- expected: expected_board,
29
- actual: actual_board
30
- } unless boards_match && headers_match
25
+ if !boards_match || !headers_match
26
+ status = boards_match && !headers_match ?
27
+ :check_final_board_failed_different_headers :
28
+ :check_final_board_failed_different_boards
29
+
30
+ fail_with status: status,
31
+ result: {
32
+ initial: result[:initialBoard],
33
+ expected: expected_board,
34
+ actual: actual_board
35
+ }
36
+ end
31
37
  end
32
38
 
33
39
  def check_error(output, expected)
@@ -27,10 +27,12 @@ class Gobstones::Batch
27
27
  end
28
28
 
29
29
  def example_base_json(example)
30
- {initialBoard: example[:preconditions][:initial_board],
31
- originalCode: content,
32
- code: example_code(example),
33
- extraCode: extra}
30
+ json = {initialBoard: example[:preconditions][:initial_board],
31
+ code: example_code(example),
32
+ extraCode: extra}
33
+
34
+ json[:originalCode] = content if json[:code] != content
35
+ json
34
36
  end
35
37
 
36
38
  def example_code(example)
@@ -5,7 +5,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
5
5
 
6
6
  Mumukit.runner_name = 'gobstones'
7
7
  Mumukit.configure do |config|
8
- config.docker_image = 'mumuki/mumuki-gobstones-worker:1.8'
8
+ config.docker_image = 'mumuki/mumuki-gobstones-worker:1.10'
9
9
  config.content_type = 'html'
10
10
  config.structured = true
11
11
  end
data/lib/locales/en.yml CHANGED
@@ -2,6 +2,7 @@ en:
2
2
  actual_board: 'Actual final board'
3
3
  check_failed_unexpected_boom: 'The program did BOOM.'
4
4
  check_final_board_failed_different_boards: 'A different board was obtained'
5
+ check_final_board_failed_different_headers: "The obtained board is almost as expected, but the head doesn't match"
5
6
  check_error_failed_expected_boom: 'The program was expected to BOOM but a final board was obtained.'
6
7
  check_error_failed_another_reason: 'The program was expected to fail by <strong>%{expected_code}</strong>, but it failed by another reason.'
7
8
  check_return_failed_different_values: '<strong>%{expected_value}</strong> was expected but <strong>%{actual_value}</strong> was obtained.'
data/lib/locales/es.yml CHANGED
@@ -2,6 +2,7 @@ es:
2
2
  actual_board: 'Tablero final obtenido'
3
3
  check_failed_unexpected_boom: 'El programa hizo BOOM.'
4
4
  check_final_board_failed_different_boards: 'Se obtuvo un tablero distinto al esperado.'
5
+ check_final_board_failed_different_headers: 'Se obtuvo un tablero casi igual al esperado, pero el cabezal no coincide.'
5
6
  check_error_failed_expected_boom: 'Se esperaba que el programa hiciera BOOM, pero se ejecutó normalmente.'
6
7
  check_error_failed_another_reason: 'Se esperaba que el programa hiciera BOOM por <strong>%{expected_code}</strong> pero falló por otro motivo.'
7
8
  check_return_failed_different_values: 'Se esperaba <strong>%{expected_value}</strong> pero se obtuvo <strong>%{actual_value}</strong>.'
data/lib/locales/pt.yml CHANGED
@@ -2,6 +2,7 @@ pt:
2
2
  actual_board: 'Tabuleiro final obtido'
3
3
  check_failed_unexpected_boom: 'O programa fez BOOM.'
4
4
  check_final_board_failed_different_boards: 'Um tabuleiro diferente foi obtido do que o esperado'
5
+ check_final_board_failed_different_headers: 'O tabuleiro é quase o mesmo que esperava-se, mas a cabeça não coincide'
5
6
  check_error_failed_expected_boom: 'Esperava-se que o programa fizesse BOOM, mas foi executado normalmente'
6
7
  check_error_failed_another_reason: 'Esperava-se que o programa fosse BOOM para <strong>%{expected_code}</strong>, mas falhou por outro motivo'
7
8
  check_return_failed_different_values: 'Esperava-se <strong>%{expected_value}</strong> mas foi obtido <strong>%{actual_value}</strong>.'
@@ -9,13 +9,17 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
9
9
  end
10
10
 
11
11
  def command_line(filename)
12
- "gobstones-cli --batch #{filename} #{locale_argument}"
12
+ "gobstones-cli --batch #{filename} #{locale_argument} #{timeout_argument}"
13
13
  end
14
14
 
15
15
  def locale_argument
16
16
  "--language #{@locale}" if @locale
17
17
  end
18
18
 
19
+ def timeout_argument
20
+ "--timeout #{(Mumukit.config.command_time_limit - 1) * 1000}"
21
+ end
22
+
19
23
  def compile(request)
20
24
  add_missing_headers! request
21
25
  @locale = request[:locale]
@@ -35,6 +39,17 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
35
39
  end
36
40
 
37
41
  def post_process_file(_file, result, status)
38
- [result.parse_as_json, status]
42
+ if status == :passed
43
+ result = result.parse_as_json
44
+ status = :aborted if is_timeout? result and !@batch.options[:expect_endless_while]
45
+ end
46
+
47
+ [result, status]
48
+ end
49
+
50
+ private
51
+
52
+ def is_timeout?(result)
53
+ result[0]&.dig(:result, :finalBoardError, :reason, :code) === 'timeout'
39
54
  end
40
55
  end
@@ -1,10 +1,12 @@
1
- <link href="./gs-element-blockly.html" rel="import" />
2
- <link href="./gobstones-code-runner.html" rel="import" />
1
+ <link href="./gs-element-blockly.html" rel="import"/>
2
+ <link href="./gobstones-code-runner.html" rel="import"/>
3
3
 
4
4
  <dom-module id="mu-gobstones-custom-editor">
5
5
  <template>
6
- <gs-element-blockly read-only="{{readOnly}}" id="blocklyElement" media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
7
- <gs-element-blockly id="blocklyTmp" style="display: none" media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
6
+ <gs-element-blockly read-only="{{readOnly}}" id="blocklyElement"
7
+ media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
8
+ <gs-element-blockly id="blocklyTmp" style="display: none"
9
+ media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
8
10
  </template>
9
11
 
10
12
  <script>
@@ -14,34 +16,49 @@
14
16
  readOnly: {
15
17
  type: Boolean,
16
18
  value: false
19
+ },
20
+ startEmpty: {
21
+ type: Boolean,
22
+ default: false
17
23
  }
18
24
  },
19
25
 
20
- attached: function() {
26
+ attached: function () {
21
27
  const setBlocklyColors = () => {
22
- if (typeof Blockly === 'undefined' || !Blockly.GOBSTONES_COLORS) return setTimeout(setBlocklyColors, 50);
28
+ if (typeof Blockly === 'undefined' || !Blockly.CUSTOM_COLORS) return setTimeout(setBlocklyColors, 50);
23
29
  Blockly.HSV_SATURATION = 0.64;
24
30
  Blockly.HSV_VALUE = 1;
25
31
 
26
32
  Blockly.MUMUKI_COLORS = {
27
- pink: 346,
28
- blue: 204,
29
- yellow: 40
33
+ pink: "#FF5C82",
34
+ blue: "#5CBEFF",
35
+ yellow: "#FFC95C"
30
36
  };
31
37
 
32
- Blockly.Msg.MATH_HUE = Blockly.MUMUKI_COLORS.blue;
33
- Blockly.GOBSTONES_COLORS.literalExpression = Blockly.MUMUKI_COLORS.blue;
34
-
35
- Blockly.GOBSTONES_COLORS.program = Blockly.MUMUKI_COLORS.pink;
36
- Blockly.GOBSTONES_COLORS.interactiveProgram = Blockly.MUMUKI_COLORS.pink;
37
- Blockly.GOBSTONES_COLORS.interactiveBinding = Blockly.MUMUKI_COLORS.pink;
38
-
39
- Blockly.GOBSTONES_COLORS.controlStructure = Blockly.MUMUKI_COLORS.yellow;
40
- Blockly.GOBSTONES_COLORS.primitiveCommand = Blockly.MUMUKI_COLORS.yellow;
41
- Blockly.GOBSTONES_COLORS.complete = Blockly.MUMUKI_COLORS.yellow;
42
- Blockly.GOBSTONES_COLORS.expression = Blockly.MUMUKI_COLORS.yellow;
43
- Blockly.GOBSTONES_COLORS.assignation = Blockly.MUMUKI_COLORS.yellow;
44
- }
38
+ // reserved
39
+ Blockly.CUSTOM_COLORS.program = Blockly.MUMUKI_COLORS.pink;
40
+ Blockly.CUSTOM_COLORS.interactiveProgram = Blockly.MUMUKI_COLORS.pink;
41
+ Blockly.CUSTOM_COLORS.interactiveBinding = Blockly.MUMUKI_COLORS.pink;
42
+ Blockly.CUSTOM_COLORS.procedure = Blockly.MUMUKI_COLORS.pink;
43
+ Blockly.CUSTOM_COLORS.function = Blockly.MUMUKI_COLORS.pink;
44
+ Blockly.CUSTOM_COLORS.complete = Blockly.MUMUKI_COLORS.pink;
45
+
46
+ // commands
47
+ Blockly.CUSTOM_COLORS.controlStructure = Blockly.MUMUKI_COLORS.yellow;
48
+ Blockly.CUSTOM_COLORS.primitiveCommand = Blockly.MUMUKI_COLORS.yellow;
49
+ Blockly.CUSTOM_COLORS.primitiveProcedure = Blockly.MUMUKI_COLORS.yellow;
50
+ Blockly.CUSTOM_COLORS.procedure_call = Blockly.MUMUKI_COLORS.yellow;
51
+ Blockly.CUSTOM_COLORS.assignation = Blockly.MUMUKI_COLORS.yellow;
52
+
53
+ // expressions
54
+ Blockly.Msg.MATH_HUE = Blockly.MUMUKI_COLORS.blue;
55
+ Blockly.CUSTOM_COLORS.literalExpression = Blockly.MUMUKI_COLORS.blue;
56
+ Blockly.CUSTOM_COLORS.variable = Blockly.MUMUKI_COLORS.blue;
57
+ Blockly.CUSTOM_COLORS.parameter = Blockly.MUMUKI_COLORS.blue;
58
+ Blockly.CUSTOM_COLORS.primitiveFunction = Blockly.MUMUKI_COLORS.blue;
59
+ Blockly.CUSTOM_COLORS.function_call = Blockly.MUMUKI_COLORS.blue;
60
+ Blockly.CUSTOM_COLORS.expression = Blockly.MUMUKI_COLORS.blue;
61
+ };
45
62
 
46
63
  const updateFields = () => {
47
64
  const blockly = this.getBlockly();
@@ -49,7 +66,7 @@
49
66
  if (editorValue) {
50
67
  editorValue.value = blockly.workspaceXml;
51
68
  }
52
- if (typeof angular !== 'undefined'){
69
+ if (typeof angular !== 'undefined') {
53
70
  angular.element(editorValue).triggerHandler("change");
54
71
  }
55
72
 
@@ -59,12 +76,42 @@
59
76
  }
60
77
  };
61
78
 
79
+ const setTrashPosition = () => {
80
+ var width = $('#blocklyDiv').width() - 68;
81
+ var height = $('#blocklyDiv').height() - 210;
82
+ $('.blocklyTrash').css("transform", `translate(${width}px, ${height}px)`);
83
+ $('.blocklyTrash').css("display", "unset");
84
+ };
85
+
86
+ var setTrashTimeout;
87
+
88
+ const localOnResize = () => {
89
+ clearTimeout(setTrashTimeout);
90
+ setTrashTimeout = setTimeout(() => {
91
+ setTrashPosition();
92
+ });
93
+ };
94
+
95
+ const triggerResizeOnContextModalClose = () => {
96
+ $('#kids-context, #kids-results').on('hidden.bs.modal shown.bs.modal', function () {
97
+ localOnResize();
98
+ })
99
+ };
100
+
101
+ const relocateTrash = (blockly) => {
102
+ blockly.workspace.trashcan.bottom_ = 150; //Setting vertical position programmatically to adjust the draggable area
103
+ $(window).resize((e) => localOnResize());
104
+ triggerResizeOnContextModalClose();
105
+ };
106
+
62
107
  const initialize = () => {
63
108
  setTimeout(() => {
64
109
  const blockly = this.getBlockly();
65
110
 
66
111
  if (!blockly || !blockly.workspace) return initialize();
67
112
 
113
+ relocateTrash(blockly);
114
+
68
115
  const teacherCode = this.getTeacherCode();
69
116
  if (teacherCode) {
70
117
  setTimeout(() => {
@@ -74,11 +121,20 @@
74
121
  });
75
122
  }
76
123
 
124
+ this._setInitialXml(blockly);
125
+
77
126
  var value = $("#mu-custom-editor-value")[0].value;
78
127
  if (value) {
79
128
  blockly.workspaceXml = value;
129
+ } else {
130
+ if (this.startEmpty) {
131
+ blockly.workspaceXml = "<xml></xml>";
132
+ }
80
133
  }
81
134
 
135
+ localOnResize();
136
+
137
+ blockly._onresize();
82
138
  blockly.workspace.addChangeListener(updateFields);
83
139
  updateFields();
84
140
  }, 50);
@@ -88,25 +144,36 @@
88
144
  initialize();
89
145
  },
90
146
 
91
- getBlockly: function() {
147
+ getBlockly: function () {
92
148
  return this.$.blocklyElement;
93
149
  },
94
150
 
95
- getStudentCode: function() {
151
+ getStudentCode: function () {
96
152
  return this
97
153
  .getBlockly()
98
- .generateCode({ withRegions: true, clearErrors: false });
154
+ .generateCode({withRegions: true, clearErrors: false});
99
155
  },
100
156
 
101
- getStudentXml: function() {
157
+ getStudentXml: function () {
102
158
  return $("#mu-custom-editor-value")[0].value || "";
103
159
  },
104
- getTeacherCode: function() {
160
+
161
+ getTeacherCode: function () {
105
162
  const teacherXml = $("#mu-custom-editor-extra")[0];
106
163
  if (!teacherXml || !teacherXml.value) return;
107
164
  this.$.blocklyTmp.workspaceXml = teacherXml.value;
108
165
  return this.$.blocklyTmp.generateCode();
166
+ },
167
+
168
+ _setInitialXml: function (blockly) {
169
+ const editorDefaultContent = $("#mu-custom-editor-default-value")[0];
170
+ if (editorDefaultContent && editorDefaultContent.value) {
171
+ blockly.initialXml = editorDefaultContent.value;
172
+ } else {
173
+ blockly.initialXml = blockly.workspaceXml;
174
+ }
109
175
  }
176
+
110
177
  });
111
178
  </script>
112
179
  </dom-module>
@@ -138,15 +205,20 @@
138
205
  }
139
206
 
140
207
  @-webkit-keyframes sk-bounce {
141
- 0%, 100% { -webkit-transform: scale(0.0) }
142
- 50% { -webkit-transform: scale(1.0) }
208
+ 0%, 100% {
209
+ -webkit-transform: scale(0.0)
210
+ }
211
+ 50% {
212
+ -webkit-transform: scale(1.0)
213
+ }
143
214
  }
144
215
 
145
216
  @keyframes sk-bounce {
146
217
  0%, 100% {
147
218
  transform: scale(0.0);
148
219
  -webkit-transform: scale(0.0);
149
- } 50% {
220
+ }
221
+ 50% {
150
222
  transform: scale(1.0);
151
223
  -webkit-transform: scale(1.0);
152
224
  }
@@ -167,10 +239,51 @@
167
239
  </script>
168
240
  </dom-module>
169
241
 
242
+
243
+ <dom-module id="kids-reset-button">
244
+
245
+ <template>
246
+ <style>
247
+ </style>
248
+
249
+ <div>
250
+ <paper-fab id="gbsResetButton"
251
+ icon="av:replay"
252
+ on-click="_onButtonClick"
253
+ ></paper-fab>
254
+ </div>
255
+ </template>
256
+
257
+ <script>
258
+ Polymer({
259
+ is: 'kids-reset-button',
260
+
261
+ _onButtonClick: function () {
262
+ const blockly = this._getBlockly();
263
+ blockly.workspaceXml = blockly.initialXml;
264
+ },
265
+
266
+ _getBlockly: function () {
267
+ return this._getEditor().getBlockly();
268
+ },
269
+
270
+ _getEditor: function () {
271
+ return $("mu-gobstones-custom-editor")[0];
272
+ }
273
+ });
274
+ </script>
275
+ </dom-module>
276
+
170
277
  <dom-module id="kids-submit-button">
171
278
  <style>
172
- .hidden { visibility: hidden; }
173
- .visible { visibility: visible; }
279
+ .hidden {
280
+ visibility: hidden;
281
+ }
282
+
283
+ .visible {
284
+ visibility: visible;
285
+ }
286
+
174
287
  .spinner {
175
288
  position: absolute;
176
289
  top: 0;
@@ -191,7 +304,8 @@
191
304
  is: "kids-submit-button",
192
305
  listeners: {
193
306
  "gbs-run-request": "_onRunRequest",
194
- "gbs-stop": "_onStop"
307
+ "gbs-stop": "_onStop",
308
+ "gbs-reset-state": "_onResetState"
195
309
  },
196
310
  properties: {
197
311
  serverPromise: Object,
@@ -202,33 +316,31 @@
202
316
  }
203
317
  },
204
318
 
205
- ready: function() {
319
+ ready: function () {
206
320
 
207
321
  const setInitialState = () => {
208
322
  const initialBoard = this._getTargetBoard();
209
- if(!initialBoard.size) return setTimeout(setInitialState, 50);
323
+ if (!initialBoard.size) return setTimeout(setInitialState, 50);
210
324
 
211
325
  this.initialState = {
212
326
  size: initialBoard.size,
213
327
  table: initialBoard.table,
214
328
  header: initialBoard.header
215
329
  };
216
-
217
- this._resetBoardOnClose(this.initialState, initialBoard);
218
330
  }
219
331
 
220
332
  setInitialState();
221
333
  },
222
334
 
223
- _onRunRequest: function(event) {
224
- const { detail: controller } = event;
335
+ _onRunRequest: function (event) {
336
+ const {detail: controller} = event;
225
337
 
226
338
  const editor = this._getEditor();
227
339
  const xml = editor.getStudentXml();
228
340
  const code = editor.getStudentCode();
229
341
  const teacherCode = editor.getTeacherCode() || "";
230
342
  const finalBoard = this._getTargetBoard();
231
- const solution = { content: xml };
343
+ const solution = {content: xml};
232
344
  const executionSpeed = 2;
233
345
 
234
346
  this._cleanState();
@@ -240,6 +352,9 @@
240
352
  if (promise !== this.serverPromise) return;
241
353
 
242
354
  this._onRemoteExecutionStop(results)
355
+ })
356
+ .catch(() => {
357
+ mumuki.kids.showResult({status: 'aborted'})
243
358
  });
244
359
  this.serverPromise = promise;
245
360
 
@@ -258,37 +373,41 @@
258
373
  this._updateBoard(state, finalBoard);
259
374
  },
260
375
  onCompilationError: (error) => {
261
- const { region } = error.on;
376
+ const {region} = error.on;
262
377
  if (region) this._showError(region, error);
263
378
  }
264
379
  }, executionSpeed);
265
380
  },
266
381
 
267
- _onStop: function(event) {
382
+ _onStop: function (event) {
268
383
  const reason = event.detail;
269
384
 
270
- if (reason === "end") this._onLocalExecutionStop();
385
+ if (reason === "end") {
386
+ this._onLocalExecutionStop();
387
+ this._toggleInitialState();
388
+ this.$.runner.isDirty = true;
389
+ }
271
390
  else this.serverPromise = undefined;
272
391
  },
273
392
 
274
- _onLocalExecutionStop: function() {
393
+ _onLocalExecutionStop: function () {
275
394
  if (!this.serverResponse) this.isWaiting = true;
276
395
  else this._onExecutionStop(this.serverResponse);
277
396
  },
278
397
 
279
- _onRemoteExecutionStop: function(serverResponse) {
398
+ _onRemoteExecutionStop: function (serverResponse) {
280
399
  this.serverResponse = serverResponse;
281
400
 
282
401
  if (!this.$.runner.isRunning) this._onExecutionStop(serverResponse);
283
402
  },
284
403
 
285
- _onExecutionStop: function(data) {
404
+ _onExecutionStop: function (data) {
286
405
  this._cleanState();
287
- mumuki.showKidsResult(data);
406
+ mumuki.kids.showResult(data);
288
407
  },
289
408
 
290
- _updateBoard: function(state, finalBoard) {
291
- const { error, table, head } = state;
409
+ _updateBoard: function (state, finalBoard) {
410
+ const {error, table, head} = state;
292
411
 
293
412
  finalBoard.boom = error != null;
294
413
 
@@ -300,57 +419,67 @@
300
419
  }
301
420
  },
302
421
 
303
- _highlight: function(region) {
422
+ _highlight: function (region) {
304
423
  this._getBlockly().highlightBlock(region);
305
424
  },
306
425
 
307
- _showError: function(region, error) {
426
+ _showError: function (region, error) {
308
427
  this._getBlockly().showBlockError(region, error.message);
309
428
  },
310
429
 
311
- _cleanState: function() {
430
+ _cleanState: function () {
312
431
  this.serverPromise = undefined;
313
432
  this.serverResponse = undefined;
314
433
  this.isWaiting = false;
315
434
  },
316
435
 
317
- _cleanErrors: function(finalBoard) {
436
+ _cleanErrors: function (finalBoard) {
318
437
  this._getBlockly().workspace.removeBlockErrors();
319
438
  finalBoard.boom = false;
320
439
  },
321
440
 
322
- _getLastRegion: function(context = {}) {
323
- const { regionStack } = context;
441
+ _getLastRegion: function (context = {}) {
442
+ const {regionStack} = context;
324
443
  return regionStack && regionStack.filter(it => it).slice(-1)[0];
325
444
  },
326
445
 
327
- _getBlockly: function() {
446
+ _getBlockly: function () {
328
447
  return this._getEditor().getBlockly();
329
448
  },
330
449
 
331
- _getEditor: function() {
450
+ _getEditor: function () {
332
451
  return $("mu-gobstones-custom-editor")[0];
333
452
  },
334
453
 
335
- _getTargetBoard: function() {
454
+ _getTargetBoard: function () {
336
455
  return $(".mu-kids-gbs-board-initial gs-board")[0];
337
456
  },
338
457
 
339
- _getSubmitCss: function(isWaiting) {
458
+ _getSubmitCss: function (isWaiting) {
340
459
  return isWaiting ? "hidden" : "visible";
341
460
  },
342
461
 
343
- _getSpinnerCss: function(isWaiting) {
462
+ _getSpinnerCss: function (isWaiting) {
344
463
  return isWaiting ? "visible" : "hidden";
345
464
  },
346
465
 
347
- _resetBoardOnClose: function(initialState, initialBoard){
348
- const modal = mumuki.getKidsResultsModal();
466
+ _resetBoard: function () {
467
+ const initialState = this.initialState;
468
+ const initialBoard = this._getTargetBoard();
469
+ initialBoard.update(initialState.table, initialState.header);
470
+ initialBoard.boom = false;
471
+ },
349
472
 
350
- modal.on("hidden.bs.modal", function () {
351
- initialBoard.update(initialState.table, initialState.header);
352
- initialBoard.boom = false;
353
- });
473
+ _onResetState: function () {
474
+ this._getBlockly().workspace.removeBlockErrors();
475
+ this._resetBoard();
476
+ this._toggleInitialState();
477
+ mumuki.kids.restart();
478
+ },
479
+
480
+ _toggleInitialState: function () {
481
+ $("#mu-initial-state-text").toggle();
482
+ $("#mu-actual-state-text").toggle();
354
483
  }
355
484
  });
356
485
  </script>
@@ -365,14 +494,14 @@
365
494
  observer: '_attireChanged'
366
495
  },
367
496
 
368
- attached: function() {
497
+ attached: function () {
369
498
  this._setAttire();
370
499
  },
371
- _attireChanged: function() {
500
+ _attireChanged: function () {
372
501
  this._setAttire();
373
502
  },
374
- _setAttire: function() {
375
- $.getJSON(this.attireUrl, function(attire) {
503
+ _setAttire: function () {
504
+ $.getJSON(this.attireUrl, function (attire) {
376
505
  GobstonesBoard && GobstonesBoard.setDefaultAttire(attire);
377
506
  });
378
507
  }
@@ -389,14 +518,14 @@
389
518
  observer: '_toolboxChanged'
390
519
  },
391
520
 
392
- attached: function() {
521
+ attached: function () {
393
522
  this._setToolbox();
394
523
  },
395
- _toolboxChanged: function() {
524
+ _toolboxChanged: function () {
396
525
  this._setToolbox();
397
526
  },
398
- _setToolbox: function() {
399
- $.get(this.toolboxUrl, function(toolboxXml) {
527
+ _setToolbox: function () {
528
+ $.get(this.toolboxUrl, function (toolboxXml) {
400
529
  const blockly = $("mu-gobstones-custom-editor")[0].getBlockly();
401
530
  blockly.setDefaultToolbox(toolboxXml);
402
531
  });
@@ -1,5 +1,6 @@
1
1
  $(document).ready(function () {
2
2
  $(".mu-kids-submit-button").html("<kids-submit-button></kids-submit-button>");
3
+ $(".mu-kids-reset-button").html("<kids-reset-button></kids-reset-button>");
3
4
 
4
5
  Blockly.WorkspaceAudio.prototype.preload = function () {
5
6
  for (var soundName in this.SOUNDS_) {
@@ -18,6 +18,11 @@ module Gobstones
18
18
  boards: prepare_boards([:initial, :expected, :actual], result)
19
19
  end
20
20
 
21
+ def render_error_check_final_board_failed_different_headers(result)
22
+ bind_result error: :check_final_board_failed_different_headers,
23
+ boards: prepare_boards([:initial, :expected, :actual], result)
24
+ end
25
+
21
26
  def render_error_check_failed_unexpected_boom(result)
22
27
  bind_result error: :check_failed_unexpected_boom,
23
28
  boards: prepare_boards([:initial, :expected, :actual], result),
data/lib/version_hook.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '1.6.1'
2
+ VERSION = '1.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-gobstones-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.14'
47
+ version: '1.15'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.14'
54
+ version: '1.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gobstones-blockly
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.10'
61
+ version: '0.12'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.10'
68
+ version: '0.12'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gobstones-code-runner
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.0'
75
+ version: '0.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.0'
82
+ version: '0.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement