Skip to content

Commit

Permalink
Updated games file and slightly cleaned up the display code
Browse files Browse the repository at this point in the history
  • Loading branch information
guydav committed Jan 16, 2024
1 parent db4c21b commit 095cb90
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 23 deletions.
118 changes: 104 additions & 14 deletions data/games.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/components/atoms/GameTextDisplay.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref } from 'vue';
import { onMounted, ref, computed } from 'vue';
const highlightedText = ref('');
let getHighlightedText = null;
Expand All @@ -26,7 +26,10 @@ onMounted(() => {
</script>

<template>
<div class="has-text-left has-text-weight-semibold has-background-white-ter" @mouseup="getHighlightedText">
{{ props.game }}
<div class="has-text-left has-background-white-ter" style="white-space: pre-line;" @mouseup="getHighlightedText">
<div v-for="line in props.game.replaceAll('\n\n', '\n').split('\n')">
<span class="has-text-weight-semibold">{{ line.split(" ", 1)[0] }}</span>
<span>{{ line.substring(line.split(" ", 1)[0].length) }}</span>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/molecules/SingleGameExtendedJudgment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function specifyOptions(spec) {
:label="question.label"
v-model="answers[question.id]"
:type="'type' in question ? question.type : QUESTION_TYPE"
:options="specifyOptions(question.options)"
:options="'options' in question ? specifyOptions(question.options) : null"
:validation="'validation' in question ? question.validation : VALIDATION_TYPE"
:help="'help' in question ? question.help : null"
:placeholder="'placeholder' in question ? question.placeholder : null"
Expand Down
1 change: 1 addition & 0 deletions src/components/pages/QuizPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function checkQuiz() {
// increment the attempts at the quiz
smilestore.incrementQuizAttempts();
forminfo.attempt = smilestore.getQuizAttempts; // e.g., first time submitting the quiz is attempt 1
forminfo.foo = undefined;
// save the answers
smilestore.saveQuizForm(forminfo); // todo: if too many attempts are incorrect, end experiment?
Expand Down
8 changes: 5 additions & 3 deletions src/components/pages/Task1Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ function sampleGames() {
const games = [];
if ('realGames' in gamesData && smilestore.getNRealGames > 0) {
const realGameKeys = Object.keys(gamesData.realGames);
console.log(`Found # real games: ${realGameKeys.length}`);
const selectedKeys = realGameKeys.length <= smilestore.getNRealGames ? realGameKeys : random.shuffle(realGameKeys).slice(0, smilestore.getNRealGames);
const realGames = selectedKeys.map((key) => ({
...gamesData.realGames[key],
text: gamesData.realGames[key],
id: key,
real: true,
matched: true,
Expand All @@ -42,7 +43,7 @@ function sampleGames() {
realGames.forEach((realGameEntry) => {
if (realGameEntry.id in gamesData.matchedArchiveGames) {
matchedGames.push({
...gamesData.matchedArchiveGames[realGameEntry.id],
text: gamesData.matchedArchiveGames[realGameEntry.id],
id: realGameEntry.id,
real: false,
matched: true,
Expand All @@ -58,9 +59,10 @@ function sampleGames() {
if ('novelArchiveGames' in gamesData && smilestore.getNNovelGames > 0) {
const novelGameKeys = Object.keys(gamesData.novelArchiveGames);
console.log(`Found # novel games: ${novelGameKeys.length}`);
const selectedNovelKeys = novelGameKeys.length <= smilestore.getNNovelGames ? novelGameKeys : random.shuffle(novelGameKeys).slice(0, smilestore.getNNovelGames);
const novelGames = selectedNovelKeys.map((key) => ({
...gamesData.novelArchiveGames[key],
text: gamesData.novelArchiveGames[key],
id: key,
real: false,
matched: false,
Expand Down
2 changes: 2 additions & 0 deletions src/stores/firestore-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { split } from 'lodash'
// since this is a module these will run once at the start
const firebaseApp = initializeApp(appconfig.firebaseConfig)
const db = getFirestore(firebaseApp)
db._setSettings({ignoreUndefinedProperties: true})

let mode = 'real'
if (appconfig.mode === 'development') {
mode = 'testing'
Expand Down
4 changes: 2 additions & 2 deletions src/stores/smiledata.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const useSmileStore = defineStore('smilestore', {
paired_game_results: [],
quiz_form: [], // array of quiz attempts
quiz_attempts: 0,
n_real_games: 10,
n_novel_games: 20,
n_real_games: 6,
n_novel_games: 8,
},
config: appconfig,
}),
Expand Down

0 comments on commit 095cb90

Please sign in to comment.