@windward/games 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/bitbucket/releases/delete-rc-tags.sh +35 -0
- package/bitbucket/releases/tag-master-release.sh +48 -0
- package/bitbucket-pipelines.yml +11 -1
- package/components/content/blocks/dragDrop/BucketGame.vue +1 -1
- package/components/settings/BucketGameSettingsManager.vue +3 -3
- package/components/settings/FlashCardSlidesManager.vue +4 -5
- package/components/settings/MatchingGameManager.vue +147 -0
- package/components/settings/SortingGameSettingsManager.vue +102 -1
- package/i18n/en-US/components/settings/bucket_game.ts +1 -1
- package/i18n/en-US/components/settings/matching_game.ts +5 -0
- package/i18n/en-US/components/settings/sorting_game.ts +7 -0
- package/i18n/es-ES/components/settings/bucket_game.ts +1 -1
- package/i18n/es-ES/components/settings/matching_game.ts +5 -0
- package/i18n/es-ES/components/settings/sorting_game.ts +7 -0
- package/i18n/sv-SE/components/settings/bucket_game.ts +1 -1
- package/i18n/sv-SE/components/settings/matching_game.ts +5 -0
- package/i18n/sv-SE/components/settings/sorting_game.ts +7 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Release [0.21.0] - 2025-07-29
|
|
4
|
+
|
|
5
|
+
* Merged in feature/LE-1912/sorting-game-generation (pull request #246)
|
|
6
|
+
* Merged in feature/LE-1913/matching-block (pull request #245)
|
|
7
|
+
* Merge branch 'release/0.21.0' into feature/LE-1913/matching-block
|
|
8
|
+
* Merge branch 'develop' into Feature/LE-1913/matching-block
|
|
9
|
+
* Merge branch 'develop' into feature/LE-1882/bucket-games
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Release [0.20.0] - 2025-06-25
|
|
13
|
+
|
|
14
|
+
* Merged in feature/LE-1948/empty-bucket (pull request #242)
|
|
15
|
+
* Merged in LE-1951-bucket-update-default-instructio (pull request #239)
|
|
16
|
+
* Merged in bugfix/LE-1954-bucket-long-answers-have-both-sc (pull request #240)
|
|
17
|
+
* Merged in bugfix/LE-1906-ai-assistant-button-text (pull request #241)
|
|
18
|
+
|
|
19
|
+
|
|
3
20
|
### Hotfix [0.19.1] created - 2025-06-16
|
|
4
21
|
|
|
5
22
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Checkout the release branch
|
|
4
|
+
git checkout master || exit 1
|
|
5
|
+
git pull origin master || exit 1
|
|
6
|
+
|
|
7
|
+
# Configure Git user for the current repository
|
|
8
|
+
git config user.email "commits-noreply@bitbucket.org"
|
|
9
|
+
git config user.name "bitbucket-pipelines"
|
|
10
|
+
|
|
11
|
+
# Extract version from the last merge commit message. Expecting `Merged in xx.xx.xx`
|
|
12
|
+
VERSION=$(basename "$(git log -1 --pretty=%B | grep -o -E "Merged in (release|hotfix)\/([0-9]+\.[0-9]+\.[0-9]+)")")
|
|
13
|
+
|
|
14
|
+
if [ -z "$VERSION" ]; then
|
|
15
|
+
echo "Error: Could not extract version from release branch name."
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "Running auto-rc-tag delete for version $VERSION"
|
|
20
|
+
|
|
21
|
+
# Delete all rc tags for the version
|
|
22
|
+
rc_tags=$(git tag --list "$VERSION-rc*")
|
|
23
|
+
|
|
24
|
+
if [ -n "$rc_tags" ]; then
|
|
25
|
+
echo "Deleting rc tags for version $VERSION..."
|
|
26
|
+
for tag in $rc_tags; do
|
|
27
|
+
git tag -d "$tag"
|
|
28
|
+
git push origin ":refs/tags/$tag"
|
|
29
|
+
done
|
|
30
|
+
echo "All rc tags for version $VERSION have been deleted."
|
|
31
|
+
else
|
|
32
|
+
echo "No rc tags found for version $VERSION."
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
exit 0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Checkout the release branch
|
|
4
|
+
git checkout master || exit 1
|
|
5
|
+
git pull origin master || exit 1
|
|
6
|
+
|
|
7
|
+
# Configure Git user for the current repository
|
|
8
|
+
git config user.email "commits-noreply@bitbucket.org"
|
|
9
|
+
git config user.name "bitbucket-pipelines"
|
|
10
|
+
|
|
11
|
+
# Extract version from the last merge commit message. Expecting `Merged in xx.xx.xx`
|
|
12
|
+
VERSION=$(basename "$(git log -1 --pretty=%B | grep -o -E "Merged in (release|hotfix)\/([0-9]+\.[0-9]+\.[0-9]+)")")
|
|
13
|
+
|
|
14
|
+
if [ -z "$VERSION" ]; then
|
|
15
|
+
echo "Error: Could not extract version from release branch name."
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "Running auto-tag for version $VERSION"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Fetch the latest state of the repository
|
|
23
|
+
git fetch origin
|
|
24
|
+
|
|
25
|
+
# Get the latest commit on master branch
|
|
26
|
+
LATEST_MASTER_COMMIT=$(git rev-parse origin/master)
|
|
27
|
+
if [ $? -ne 0 ]; then
|
|
28
|
+
echo "Error: Failed to get the latest commit on master"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Apply the tag to the latest master commit
|
|
33
|
+
git tag -a "$VERSION" -m "Tagging $VERSION" "$LATEST_MASTER_COMMIT"
|
|
34
|
+
if [ $? -ne 0 ]; then
|
|
35
|
+
echo "Error: Failed to tag the commit $LATEST_MASTER_COMMIT with tag $VERSION"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Push the tag to the repository
|
|
40
|
+
git push origin "$VERSION"
|
|
41
|
+
if [ $? -ne 0 ]; then
|
|
42
|
+
echo "Error: Failed to push the tag $VERSION"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo "Tag $VERSION successfully applied to commit $LATEST_MASTER_COMMIT and pushed to repository."
|
|
47
|
+
|
|
48
|
+
exit 0
|
package/bitbucket-pipelines.yml
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
image: atlassian/default-image:3
|
|
2
2
|
|
|
3
3
|
pipelines:
|
|
4
|
+
pull-requests:
|
|
5
|
+
'**':
|
|
6
|
+
- step:
|
|
7
|
+
name: Build and test
|
|
8
|
+
image: node:16.20.2
|
|
9
|
+
script:
|
|
10
|
+
- npm install
|
|
11
|
+
- npm run test
|
|
4
12
|
custom:
|
|
5
13
|
create-release:
|
|
6
14
|
import: infrastructure-automation:master:create-release
|
|
@@ -11,4 +19,6 @@ pipelines:
|
|
|
11
19
|
"release/*":
|
|
12
20
|
import: infrastructure-automation:master:auto-update
|
|
13
21
|
"hotfix/*":
|
|
14
|
-
import: infrastructure-automation:master:auto-update
|
|
22
|
+
import: infrastructure-automation:master:auto-update
|
|
23
|
+
master:
|
|
24
|
+
import: infrastructure-automation:master:auto-publish-release
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
<v-col cols="12">
|
|
199
199
|
<GenerateAIQuestionButton
|
|
200
200
|
:course="course"
|
|
201
|
-
:content="
|
|
201
|
+
:content="currentContent"
|
|
202
202
|
:block="block"
|
|
203
203
|
question-type="bucket_game"
|
|
204
204
|
:replace-existing-mode="replaceExisting"
|
|
@@ -239,7 +239,7 @@ export default {
|
|
|
239
239
|
TextEditor,
|
|
240
240
|
GenerateAIQuestionButton,
|
|
241
241
|
},
|
|
242
|
-
beforeMount() {
|
|
242
|
+
beforeMount() {
|
|
243
243
|
if (_.isEmpty(this.block)) {
|
|
244
244
|
this.block = {}
|
|
245
245
|
}
|
|
@@ -301,7 +301,7 @@ export default {
|
|
|
301
301
|
computed: {
|
|
302
302
|
...mapGetters({
|
|
303
303
|
course: 'course/get',
|
|
304
|
-
|
|
304
|
+
currentContent: 'content/get',
|
|
305
305
|
}),
|
|
306
306
|
},
|
|
307
307
|
methods: {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
:disabled="render"
|
|
22
22
|
@click:close="onDelete($event)"
|
|
23
23
|
>
|
|
24
|
-
<template #header="{
|
|
24
|
+
<template #header="{ index }">
|
|
25
25
|
{{
|
|
26
26
|
stripHtml(block.metadata.config.cards[index].front.text)
|
|
27
27
|
}}
|
|
28
28
|
</template>
|
|
29
|
-
<template #body="{
|
|
29
|
+
<template #body="{ index }">
|
|
30
30
|
<v-container>
|
|
31
31
|
<v-row
|
|
32
32
|
class="d-flex justify-space-around"
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
<v-col cols="12">
|
|
259
259
|
<GenerateAIQuestionButton
|
|
260
260
|
:course="course"
|
|
261
|
-
:content="
|
|
261
|
+
:content="currentContent"
|
|
262
262
|
:block="block"
|
|
263
263
|
question-type="flashcard"
|
|
264
264
|
:replace-existing-mode="replaceExisting"
|
|
@@ -343,7 +343,7 @@ export default {
|
|
|
343
343
|
computed: {
|
|
344
344
|
...mapGetters({
|
|
345
345
|
course: 'course/get',
|
|
346
|
-
|
|
346
|
+
currentContent: 'content/get',
|
|
347
347
|
}),
|
|
348
348
|
defaultCard() {
|
|
349
349
|
return {
|
|
@@ -511,4 +511,3 @@ export default {
|
|
|
511
511
|
},
|
|
512
512
|
}
|
|
513
513
|
</script>
|
|
514
|
-
|
|
@@ -248,12 +248,28 @@
|
|
|
248
248
|
indeterminate
|
|
249
249
|
></v-progress-circular>
|
|
250
250
|
</div>
|
|
251
|
+
<v-container class="pa-4 mb-6">
|
|
252
|
+
<v-row>
|
|
253
|
+
<v-col cols="12">
|
|
254
|
+
<GenerateAIQuestionButton
|
|
255
|
+
:course="course"
|
|
256
|
+
:content="content"
|
|
257
|
+
:block="block"
|
|
258
|
+
question-type="matching_game"
|
|
259
|
+
:replace-existing-mode="replaceExisting"
|
|
260
|
+
@click:generate="onGeneratedMatchingGame"
|
|
261
|
+
></GenerateAIQuestionButton>
|
|
262
|
+
</v-col>
|
|
263
|
+
</v-row>
|
|
264
|
+
</v-container>
|
|
251
265
|
</div>
|
|
252
266
|
</template>
|
|
253
267
|
|
|
254
268
|
<script>
|
|
255
269
|
import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
|
|
256
270
|
import _ from 'lodash'
|
|
271
|
+
import { mapGetters } from 'vuex'
|
|
272
|
+
import { GenerateAIQuestionButton } from '@windward/core/utils'
|
|
257
273
|
import BaseContentBlockSettings from '~/components/Content/Settings/BaseContentBlockSettings.vue'
|
|
258
274
|
import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
|
|
259
275
|
import Uuid from '~/helpers/Uuid'
|
|
@@ -266,6 +282,7 @@ export default {
|
|
|
266
282
|
SortableExpansionPanel,
|
|
267
283
|
ImageAssetSettings,
|
|
268
284
|
BaseContentBlockSettings,
|
|
285
|
+
GenerateAIQuestionButton
|
|
269
286
|
},
|
|
270
287
|
beforeMount() {
|
|
271
288
|
if (_.isEmpty(this.block)) {
|
|
@@ -326,8 +343,15 @@ export default {
|
|
|
326
343
|
return {
|
|
327
344
|
valid: true,
|
|
328
345
|
loading: false,
|
|
346
|
+
replaceExisting: false,
|
|
329
347
|
}
|
|
330
348
|
},
|
|
349
|
+
computed: {
|
|
350
|
+
...mapGetters({
|
|
351
|
+
course: 'course/get',
|
|
352
|
+
content: 'content/get',
|
|
353
|
+
}),
|
|
354
|
+
},
|
|
331
355
|
mounted() {},
|
|
332
356
|
methods: {
|
|
333
357
|
onAddPrompt(index = 0) {
|
|
@@ -464,6 +488,129 @@ export default {
|
|
|
464
488
|
// holder array now has new answer positions
|
|
465
489
|
this.block.metadata.config.prompts = holderArray
|
|
466
490
|
},
|
|
491
|
+
// Handler for receiving matching game data from GenerateAIQuestionButton
|
|
492
|
+
onGeneratedMatchingGame(activityData, replaceMode) {
|
|
493
|
+
|
|
494
|
+
this.loading = true
|
|
495
|
+
try {
|
|
496
|
+
// Process the activity data
|
|
497
|
+
if (activityData && activityData.metadata &&
|
|
498
|
+
activityData.metadata.config &&
|
|
499
|
+
activityData.metadata.config.answerObjects &&
|
|
500
|
+
activityData.metadata.config.prompts &&
|
|
501
|
+
Array.isArray(activityData.metadata.config.answerObjects) &&
|
|
502
|
+
Array.isArray(activityData.metadata.config.prompts)) {
|
|
503
|
+
|
|
504
|
+
if (replaceMode) {
|
|
505
|
+
// Replace mode: Clear existing answers and prompts
|
|
506
|
+
this.block.metadata.config.answerObjects.splice(0, this.block.metadata.config.answerObjects.length)
|
|
507
|
+
this.block.metadata.config.prompts.splice(0, this.block.metadata.config.prompts.length)
|
|
508
|
+
|
|
509
|
+
// Add all new answer objects and prompts
|
|
510
|
+
activityData.metadata.config.answerObjects.forEach((answerObj, index) => {
|
|
511
|
+
this.block.metadata.config.answerObjects.push({
|
|
512
|
+
id: index.toString(), // string id
|
|
513
|
+
display: answerObj.display || ''
|
|
514
|
+
})
|
|
515
|
+
})
|
|
516
|
+
|
|
517
|
+
// Add all prompts - following the exact pattern from BucketGameSettingsManager
|
|
518
|
+
activityData.metadata.config.prompts.forEach((promptArray, index) => {
|
|
519
|
+
this.block.metadata.config.prompts[index] = []
|
|
520
|
+
if (Array.isArray(promptArray)) {
|
|
521
|
+
promptArray.forEach(prompt => {
|
|
522
|
+
// Ensure the answer object reference is correct
|
|
523
|
+
const answerObj = this.block.metadata.config.answerObjects[index]
|
|
524
|
+
this.block.metadata.config.prompts[index].push({
|
|
525
|
+
id: index.toString(), // string id
|
|
526
|
+
textOrImage: prompt.textOrImage || 'text',
|
|
527
|
+
prompt: prompt.prompt || '',
|
|
528
|
+
matchExplanation: prompt.matchExplanation || this.$t('windward.games.components.settings.matching_game.form.correct_match'),
|
|
529
|
+
fileConfig: prompt.fileConfig || {
|
|
530
|
+
hideBackground: true,
|
|
531
|
+
},
|
|
532
|
+
answer: answerObj
|
|
533
|
+
})
|
|
534
|
+
})
|
|
535
|
+
}
|
|
536
|
+
})
|
|
537
|
+
} else {
|
|
538
|
+
// Merge mode: Add new terms and prompts to existing ones
|
|
539
|
+
// Check if there's only one empty answer (the default one created on init)
|
|
540
|
+
const hasOnlyEmptyAnswer = this.block.metadata.config.answerObjects.length === 1 &&
|
|
541
|
+
this.block.metadata.config.answerObjects[0].display === '';
|
|
542
|
+
|
|
543
|
+
if (hasOnlyEmptyAnswer) {
|
|
544
|
+
// If there's only one empty answer, replace it instead of merging
|
|
545
|
+
this.block.metadata.config.answerObjects.splice(0, 1);
|
|
546
|
+
this.block.metadata.config.prompts.splice(0, 1);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const existingAnswerCount = this.block.metadata.config.answerObjects.length
|
|
550
|
+
|
|
551
|
+
// Add new answer objects
|
|
552
|
+
activityData.metadata.config.answerObjects.forEach((answerObj, index) => {
|
|
553
|
+
const newIndex = existingAnswerCount + index
|
|
554
|
+
this.block.metadata.config.answerObjects.push({
|
|
555
|
+
id: newIndex.toString(), // string id
|
|
556
|
+
display: answerObj.display || ''
|
|
557
|
+
})
|
|
558
|
+
})
|
|
559
|
+
|
|
560
|
+
// Add new prompts
|
|
561
|
+
activityData.metadata.config.prompts.forEach((promptArray, index) => {
|
|
562
|
+
const adjustedIndex = existingAnswerCount + index
|
|
563
|
+
this.block.metadata.config.prompts[adjustedIndex] = []
|
|
564
|
+
if (Array.isArray(promptArray)) {
|
|
565
|
+
promptArray.forEach(prompt => {
|
|
566
|
+
const answerObj = this.block.metadata.config.answerObjects[adjustedIndex]
|
|
567
|
+
this.block.metadata.config.prompts[adjustedIndex].push({
|
|
568
|
+
id: adjustedIndex.toString(), // string id
|
|
569
|
+
textOrImage: prompt.textOrImage || 'text',
|
|
570
|
+
prompt: prompt.prompt || '',
|
|
571
|
+
matchExplanation: prompt.matchExplanation || this.$t('windward.games.components.settings.matching_game.form.correct_match'),
|
|
572
|
+
fileConfig: prompt.fileConfig || {
|
|
573
|
+
hideBackground: true,
|
|
574
|
+
},
|
|
575
|
+
answer: answerObj
|
|
576
|
+
})
|
|
577
|
+
})
|
|
578
|
+
}
|
|
579
|
+
})
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Update title and instructions if provided and we're in replace mode
|
|
583
|
+
if (replaceMode) {
|
|
584
|
+
if (activityData.metadata.config.title) {
|
|
585
|
+
this.block.metadata.config.title = activityData.metadata.config.title
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (activityData.metadata.config.instructions) {
|
|
589
|
+
this.block.metadata.config.instructions = activityData.metadata.config.instructions
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
this.$toast.success(
|
|
594
|
+
replaceMode
|
|
595
|
+
? this.$t('windward.games.components.settings.matching_game.form.replaced_successfully')
|
|
596
|
+
: this.$t('windward.games.components.settings.matching_game.form.added_successfully'),
|
|
597
|
+
{ duration: 3000 }
|
|
598
|
+
)
|
|
599
|
+
} else {
|
|
600
|
+
this.$toast.error(this.$t('windward.games.components.settings.matching_game.form.invalid_response'), {
|
|
601
|
+
duration: 5000
|
|
602
|
+
})
|
|
603
|
+
}
|
|
604
|
+
} catch (error) {
|
|
605
|
+
// Extract error message from the response
|
|
606
|
+
const errorMessage = error.message || 'Unknown error occurred'
|
|
607
|
+
this.$toast.error(`${this.$t('windward.games.components.settings.matching_game.form.failed_to_process')}: ${errorMessage}`, {
|
|
608
|
+
duration: 5000
|
|
609
|
+
})
|
|
610
|
+
} finally {
|
|
611
|
+
this.loading = false
|
|
612
|
+
}
|
|
613
|
+
}
|
|
467
614
|
},
|
|
468
615
|
}
|
|
469
616
|
</script>
|
|
@@ -79,6 +79,20 @@
|
|
|
79
79
|
:disabled="render"
|
|
80
80
|
></v-textarea>
|
|
81
81
|
</v-container>
|
|
82
|
+
<v-container class="pa-4 mb-6">
|
|
83
|
+
<v-row>
|
|
84
|
+
<v-col cols="12">
|
|
85
|
+
<GenerateAIQuestionButton
|
|
86
|
+
:course="course"
|
|
87
|
+
:content="currentContent"
|
|
88
|
+
:block="block"
|
|
89
|
+
question-type="sorting_game"
|
|
90
|
+
:replace-existing-mode="replaceExisting"
|
|
91
|
+
@click:generate="onGeneratedSortingGame"
|
|
92
|
+
></GenerateAIQuestionButton>
|
|
93
|
+
</v-col>
|
|
94
|
+
</v-row>
|
|
95
|
+
</v-container>
|
|
82
96
|
<div v-if="loading" class="text-center">
|
|
83
97
|
<v-progress-circular
|
|
84
98
|
:size="70"
|
|
@@ -92,6 +106,8 @@
|
|
|
92
106
|
|
|
93
107
|
<script>
|
|
94
108
|
import _ from 'lodash'
|
|
109
|
+
import { mapGetters } from 'vuex'
|
|
110
|
+
import { GenerateAIQuestionButton } from '@windward/core/utils'
|
|
95
111
|
import BaseContentSettings from '~/components/Content/Settings/BaseContentSettings.js'
|
|
96
112
|
import BaseContentBlockSettings from '~/components/Content/Settings/BaseContentBlockSettings.vue'
|
|
97
113
|
import SortableExpansionPanel from '~/components/Core/SortableExpansionPanel.vue'
|
|
@@ -100,7 +116,7 @@ import Uuid from '~/helpers/Uuid'
|
|
|
100
116
|
export default {
|
|
101
117
|
name: 'SortingGameSettingsManager',
|
|
102
118
|
extends: BaseContentSettings,
|
|
103
|
-
components: { SortableExpansionPanel, BaseContentBlockSettings },
|
|
119
|
+
components: { SortableExpansionPanel, BaseContentBlockSettings, GenerateAIQuestionButton },
|
|
104
120
|
beforeMount() {
|
|
105
121
|
if (_.isEmpty(this.block)) {
|
|
106
122
|
this.block = {}
|
|
@@ -148,6 +164,7 @@ export default {
|
|
|
148
164
|
valid: true,
|
|
149
165
|
dialog: false,
|
|
150
166
|
loading: false,
|
|
167
|
+
replaceExisting: false,
|
|
151
168
|
headers: [
|
|
152
169
|
{
|
|
153
170
|
text: 'Bucket Text',
|
|
@@ -159,6 +176,12 @@ export default {
|
|
|
159
176
|
cursor: null,
|
|
160
177
|
}
|
|
161
178
|
},
|
|
179
|
+
computed: {
|
|
180
|
+
...mapGetters({
|
|
181
|
+
course: 'course/get',
|
|
182
|
+
currentContent: 'content/get',
|
|
183
|
+
}),
|
|
184
|
+
},
|
|
162
185
|
methods: {
|
|
163
186
|
onAddElement() {
|
|
164
187
|
this.block.metadata.config.answer.forEach((element) => {
|
|
@@ -179,6 +202,84 @@ export default {
|
|
|
179
202
|
return (element.id = startingIndex)
|
|
180
203
|
})
|
|
181
204
|
},
|
|
205
|
+
onGeneratedSortingGame(activityData, replaceMode) {
|
|
206
|
+
this.loading = true
|
|
207
|
+
try {
|
|
208
|
+
// Process the activity data
|
|
209
|
+
if (activityData && activityData.metadata &&
|
|
210
|
+
activityData.metadata.config &&
|
|
211
|
+
activityData.metadata.config.answer &&
|
|
212
|
+
Array.isArray(activityData.metadata.config.answer)) {
|
|
213
|
+
|
|
214
|
+
// Save new items
|
|
215
|
+
const newItems = activityData.metadata.config.answer
|
|
216
|
+
|
|
217
|
+
if (replaceMode) {
|
|
218
|
+
// Replace mode: Clear existing items
|
|
219
|
+
this.block.metadata.config.answer.splice(0, this.block.metadata.config.answer.length)
|
|
220
|
+
|
|
221
|
+
// Add all new items - ensure they have the correct structure
|
|
222
|
+
newItems.forEach((item, index) => {
|
|
223
|
+
this.block.metadata.config.answer.push({
|
|
224
|
+
id: index,
|
|
225
|
+
value: item.value || '',
|
|
226
|
+
expand: false,
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
} else {
|
|
230
|
+
// Merge mode: Add new items to existing ones
|
|
231
|
+
const hasOnlyEmptyAnswer = this.block.metadata.config.answer.length === 1 &&
|
|
232
|
+
this.block.metadata.config.answer[0].value === ''
|
|
233
|
+
|
|
234
|
+
if (hasOnlyEmptyAnswer) {
|
|
235
|
+
// If there's only one empty answer, replace it instead of merging
|
|
236
|
+
this.block.metadata.config.answer.splice(0, 1)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let currentId = this.block.metadata.config.answer.length
|
|
240
|
+
|
|
241
|
+
newItems.forEach((item) => {
|
|
242
|
+
this.block.metadata.config.answer.push({
|
|
243
|
+
id: currentId,
|
|
244
|
+
value: item.value || '',
|
|
245
|
+
expand: false,
|
|
246
|
+
})
|
|
247
|
+
currentId += 1
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Update title and instructions if provided and we're in replace mode
|
|
252
|
+
if (replaceMode) {
|
|
253
|
+
if (activityData.metadata.config.title) {
|
|
254
|
+
this.block.metadata.config.title = activityData.metadata.config.title
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (activityData.metadata.config.instructions) {
|
|
258
|
+
this.block.metadata.config.instructions = activityData.metadata.config.instructions
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Update feedback if provided
|
|
262
|
+
if (activityData.metadata.config.feedback_correct) {
|
|
263
|
+
this.block.metadata.config.feedback_correct = activityData.metadata.config.feedback_correct
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this.$toast.success(
|
|
268
|
+
replaceMode
|
|
269
|
+
? this.$t('windward.games.components.settings.sorting_game.form.replaced_successfully')
|
|
270
|
+
: this.$t('windward.games.components.settings.sorting_game.form.added_successfully'),
|
|
271
|
+
{ duration: 3000 }
|
|
272
|
+
)
|
|
273
|
+
} else {
|
|
274
|
+
throw new Error('activity.error.technical')
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
// Let the error bubble up to GenerateAIQuestionButton with proper error type
|
|
278
|
+
throw error
|
|
279
|
+
} finally {
|
|
280
|
+
this.loading = false
|
|
281
|
+
}
|
|
282
|
+
},
|
|
182
283
|
},
|
|
183
284
|
}
|
|
184
285
|
</script>
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
mass_entry: 'Mass data entry',
|
|
5
5
|
title: 'Title',
|
|
6
6
|
instructions: 'Instructions',
|
|
7
|
-
default_instructions: 'Match
|
|
7
|
+
default_instructions: 'Match items and categories by dragging items and releasing them into a category area. Correctly sorted items will remain in the buckets. Keep sorting items until all of them are placed in a category.',
|
|
8
8
|
buckets: 'Bucket Items',
|
|
9
9
|
feedback: {
|
|
10
10
|
feedback: 'Feedback',
|
|
@@ -7,6 +7,11 @@ export default {
|
|
|
7
7
|
correct_match: 'This match is correct.',
|
|
8
8
|
incorrect_match: 'That’s an incorrect match. Try again.',
|
|
9
9
|
correct_match_label: 'Explanation of the correct match',
|
|
10
|
+
replace_existing: 'Replace Existing Matches',
|
|
11
|
+
added_successfully: 'Matches added successfully',
|
|
12
|
+
replaced_successfully: 'Matches replaced successfully',
|
|
13
|
+
invalid_response: 'Invalid response from AI generation',
|
|
14
|
+
failed_to_process: 'Failed to process AI response',
|
|
10
15
|
feedback: {
|
|
11
16
|
correct: 'feedback when correct',
|
|
12
17
|
incorrect: 'feedback when incorrect',
|
|
@@ -5,4 +5,11 @@ export default {
|
|
|
5
5
|
instructions: 'Drag each statement into the correct order. When you are finished, click the Check Your Answers button. Statements in the correct order will appear green, while statements not in the correct order will appear red.',
|
|
6
6
|
feedback_correct_label: 'Explanation of the correct order',
|
|
7
7
|
default_feedback_correct: 'That is the correct order.',
|
|
8
|
+
form: {
|
|
9
|
+
replace_existing: 'Replace existing items',
|
|
10
|
+
replaced_successfully: 'Items replaced successfully',
|
|
11
|
+
added_successfully: 'New items added successfully',
|
|
12
|
+
invalid_response: 'Invalid response from sorting game generation',
|
|
13
|
+
failed_to_process: 'Failed to process generated sorting game'
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
title: 'Título',
|
|
6
6
|
instructions: 'Instrucciones',
|
|
7
7
|
default_instructions:
|
|
8
|
-
'Haga coincidir
|
|
8
|
+
'Haga coincidir elementos y categorías arrastrando elementos y soltándolos en un área de categoría. Los elementos ordenados correctamente permanecerán en los depósitos. Continúe ordenando elementos hasta que todos estén colocados en una categoría.',
|
|
9
9
|
buckets: 'Elementos del depósito',
|
|
10
10
|
feedback: {
|
|
11
11
|
feedback: 'Comentarios',
|
|
@@ -16,5 +16,10 @@ export default {
|
|
|
16
16
|
char_count_less_then:
|
|
17
17
|
'El número de caracteres para este campo debe ser menor que',
|
|
18
18
|
},
|
|
19
|
+
replace_existing: 'Reemplazar coincidencias existentes',
|
|
20
|
+
added_successfully: 'Coincidencias añadidas correctamente',
|
|
21
|
+
replaced_successfully: 'Coincidencias reemplazadas correctamente',
|
|
22
|
+
invalid_response: 'Respuesta inválida de la generación de IA',
|
|
23
|
+
failed_to_process: 'Error al procesar la respuesta de IA'
|
|
19
24
|
},
|
|
20
25
|
}
|
|
@@ -5,4 +5,11 @@ export default {
|
|
|
5
5
|
instructions: 'Arrastre cada declaración al orden correcto. Cuando haya terminado, haga clic en el botón Verifique sus respuestas. Las declaraciones en el orden correcto aparecerán en verde, mientras que las declaraciones que no estén en el orden correcto aparecerán en rojo.',
|
|
6
6
|
feedback_correct_label: 'Explicación del orden correcto.',
|
|
7
7
|
default_feedback_correct: 'Ese es el orden correcto.',
|
|
8
|
+
form: {
|
|
9
|
+
replace_existing: 'Reemplazar elementos existentes',
|
|
10
|
+
replaced_successfully: 'Elementos reemplazados exitosamente',
|
|
11
|
+
added_successfully: 'Nuevos elementos agregados exitosamente',
|
|
12
|
+
invalid_response: 'Respuesta inválida de la generación de juego de ordenamiento',
|
|
13
|
+
failed_to_process: 'Error al procesar el juego de ordenamiento generado'
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
title: 'Titel',
|
|
6
6
|
instructions: 'Instruktioner',
|
|
7
7
|
default_instructions:
|
|
8
|
-
'Matcha
|
|
8
|
+
'Matcha objekt och kategorier genom att dra objekt och släppa dem i ett kategoriområde. Korrekt sorterade objekt kommer att förbli i hinkarna. Fortsätt sortera objekt tills alla är placerade i en kategori.',
|
|
9
9
|
buckets: 'Bucket Items',
|
|
10
10
|
feedback: {
|
|
11
11
|
feedback: 'Feedback',
|
|
@@ -16,5 +16,10 @@ export default {
|
|
|
16
16
|
char_count_less_then:
|
|
17
17
|
'Teckenantalet för detta fält måste vara mindre än',
|
|
18
18
|
},
|
|
19
|
+
replace_existing: 'Ersätt befintliga matchningar',
|
|
20
|
+
added_successfully: 'Matchningar har lagts till',
|
|
21
|
+
replaced_successfully: 'Matchningar har ersatts',
|
|
22
|
+
invalid_response: 'Ogiltigt svar från AI-generering',
|
|
23
|
+
failed_to_process: 'Misslyckades med att bearbeta AI-svar'
|
|
19
24
|
},
|
|
20
25
|
}
|
|
@@ -5,4 +5,11 @@ export default {
|
|
|
5
5
|
instructions: 'Dra varje påstående i rätt ordning. När du är klar klickar du på knappen Kontrollera dina svar. Påståenden i rätt ordning visas i grönt, medan påståenden som inte är i rätt ordning visas röda.',
|
|
6
6
|
feedback_correct_label: 'Förklaring av rätt ordning',
|
|
7
7
|
default_feedback_correct: 'Det är rätt ordning.',
|
|
8
|
+
form: {
|
|
9
|
+
replace_existing: 'Ersätt befintliga objekt',
|
|
10
|
+
replaced_successfully: 'Objekt ersatta framgångsrikt',
|
|
11
|
+
added_successfully: 'Nya objekt tillagda framgångsrikt',
|
|
12
|
+
invalid_response: 'Ogiltigt svar från sorteringsspelsgenerering',
|
|
13
|
+
failed_to_process: 'Misslyckades med att bearbeta genererat sorteringsspel'
|
|
14
|
+
}
|
|
8
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windward/games",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Windward UI Plugin Games",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://bitbucket.org/mindedge/windward-ui-plugin-games#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@windward/core": "^0.
|
|
24
|
+
"@windward/core": "^0.21.0",
|
|
25
25
|
"eslint": "^8.11.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"prettier": "^2.6.0",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/preset-env": "^7.16.11",
|
|
35
|
+
"@mindedge/vue-api-query": "^1.15.1",
|
|
35
36
|
"@nuxtjs/axios": "^5.13.6",
|
|
36
37
|
"@types/lodash": "^4.14.180",
|
|
37
38
|
"@vue/test-utils": "^1.1.3",
|