Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/app/plugins/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "الإعدادات",
"confirmUpload": "تأكيد التحميل"
"confirmUpload": "تأكيد التحميل",
"enableWeights": "تفعيل ميزة الأوزان"
},
"messages": {
"acceptCsv": "إذا وافقت، سيتم استبدال جميع الاستدلالات الحالية بتلك الموجودة في ملف CSV.",
"noCsvFileSelected": "لم يتم تحديد ملف CSV. \nيرجى تحديد واحد قبل المتابعة."
"noCsvFileSelected": "لم يتم تحديد ملف CSV. \nيرجى تحديد واحد قبل المتابعة.",
"enableWeightsDescription": "السماح للمقيمين بتعيين الأوزان للاستدلالات في هذه الدراسة"
},
"placeHolders": {
"importCsv": "قم باستيراد ملف CSV الخاص بك هنا."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Einstellungen",
"confirmUpload": "Upload bestätigen"
"confirmUpload": "Upload bestätigen",
"enableWeights": "Gewichtungsfunktion aktivieren"
},
"messages": {
"acceptCsv": "Wenn Sie akzeptieren, werden alle Ihre vorhandenen Heuristiken durch die in der .csv-Datei ersetzt.",
"noCsvFileSelected": "Keine CSV-Datei ausgewählt. \nBitte wählen Sie eine aus, bevor Sie fortfahren."
"noCsvFileSelected": "Keine CSV-Datei ausgewählt. \nBitte wählen Sie eine aus, bevor Sie fortfahren.",
"enableWeightsDescription": "Ermöglichen Sie es Bewertern, Gewichte für Heuristiken in dieser Studie zuzuordnen"
},
"placeHolders": {
"importCsv": "Importieren Sie Ihre CSV-Testdatei hier."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Settings",
"confirmUpload": "Confirm Upload"
"confirmUpload": "Confirm Upload",
"enableWeights": "Enable Weights Feature"
},
"messages": {
"acceptCsv": "If you accept, all your present heuristics will be replaced by the ones in the .csv file",
"noCsvFileSelected": "No csv file selected. \nPlease select one before proceeding."
"noCsvFileSelected": "No csv file selected. \nPlease select one before proceeding.",
"enableWeightsDescription": "Allow evaluators to assign weights to heuristics in this study"
},
"placeHolders": {
"importCsv": "Import your CSV testfile here."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Configuración",
"confirmUpload": "Confirmar carga"
"confirmUpload": "Confirmar carga",
"enableWeights": "Habilitar función de pesos"
},
"messages": {
"acceptCsv": "Si aceptas, todas tus heurísticas actuales serán reemplazadas por las del archivo CSV.",
"noCsvFileSelected": "No se ha seleccionado ningún archivo CSV. Por favor, selecciona uno antes de continuar."
"noCsvFileSelected": "No se ha seleccionado ningún archivo CSV. Por favor, selecciona uno antes de continuar.",
"enableWeightsDescription": "Permitir que los evaluadores asignen pesos a las heurísticas en este estudio"
},
"placeHolders": {
"importCsv": "Importa tu archivo CSV de prueba aquí."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Paramètres",
"confirmUpload": "Confirmer le téléchargement"
"confirmUpload": "Confirmer le téléchargement",
"enableWeights": "Activer la fonctionnalité de pondération"
},
"messages": {
"acceptCsv": "Si vous acceptez, toutes vos heuristiques actuelles seront remplacées par celles du fichier .csv.",
"noCsvFileSelected": "Aucun fichier CSV sélectionné. \nVeuillez en sélectionner un avant de continuer."
"noCsvFileSelected": "Aucun fichier CSV sélectionné. \nVeuillez en sélectionner un avant de continuer.",
"enableWeightsDescription": "Permettre aux évaluateurs d'attribuer des poids aux heuristiques dans cette étude"
},
"placeHolders": {
"importCsv": "Importez votre fichier CSV test ici."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "सेटिंग्स",
"confirmUpload": "अपलोड की पुष्टि करें"
"confirmUpload": "अपलोड की पुष्टि करें",
"enableWeights": "वेट फीचर सक्षम करें"
},
"messages": {
"acceptCsv": "स्वीकार करने पर, आपके सभी वर्तमान हीयुरिस्टिक्स .csv फ़ाइल में दिए गए हीयुरिस्टिक्स से बदल दिए जाएंगे।",
"noCsvFileSelected": "कोई CSV फ़ाइल चयनित नहीं है। कृपया आगे बढ़ने से पहले एक चुनें।"
"noCsvFileSelected": "कोई CSV फ़ाइल चयनित नहीं है। कृपया आगे बढ़ने से पहले एक चुनें।",
"enableWeightsDescription": "मूल्यांकनकर्ताओं को इस अध्ययन में हीयुरिस्टिक्स को वज़न आवंटित करने दें"
},
"placeHolders": {
"importCsv": "यहां अपनी परीक्षण CSV फ़ाइल आयात करें।"
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "設定",
"confirmUpload": "アップロードの確認"
"confirmUpload": "アップロードの確認",
"enableWeights": "重み機能を有効にする"
},
"messages": {
"acceptCsv": "同意すると、現在のヒューリスティックはCSVファイルの内容で置き換えられます。",
"noCsvFileSelected": "CSVファイルが選択されていません。続行する前に選択してください。"
"noCsvFileSelected": "CSVファイルが選択されていません。続行する前に選択してください。",
"enableWeightsDescription": "評価者がこの研究でヒューリスティックに重みを割り当てることを許可する"
},
"placeHolders": {
"importCsv": "ここにCSVテストファイルをインポートしてください。"
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Configurações",
"confirmUpload": "Confirmar Upload"
"confirmUpload": "Confirmar Upload",
"enableWeights": "Ativar Recurso de Pesos"
},
"messages": {
"acceptCsv": "Se aceitar, todas as suas heurísticas atuais serão substituídas pelas do arquivo CSV.",
"noCsvFileSelected": "Nenhum arquivo CSV selecionado. \nPor favor, selecione um antes de continuar."
"noCsvFileSelected": "Nenhum arquivo CSV selecionado. \nPor favor, selecione um antes de continuar.",
"enableWeightsDescription": "Permita que os avaliadores atribuam pesos às heurísticas neste estudo"
},
"placeHolders": {
"importCsv": "Importe seu arquivo CSV de teste aqui."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "Настройки",
"confirmUpload": "Подтвердить загрузку"
"confirmUpload": "Подтвердить загрузку",
"enableWeights": "Включить функцию весов"
},
"messages": {
"acceptCsv": "Если вы согласны, все ваши текущие эвристики будут заменены теми, что в CSV-файле.",
"noCsvFileSelected": "CSV-файл не выбран. \nПожалуйста, выберите один, чтобы продолжить."
"noCsvFileSelected": "CSV-файл не выбран. \nПожалуйста, выберите один, чтобы продолжить.",
"enableWeightsDescription": "Позвольте оценивающим назначать веса эвристикам в этом исследовании"
},
"placeHolders": {
"importCsv": "Импортируйте ваш CSV тестовый файл сюда."
Expand Down
6 changes: 4 additions & 2 deletions src/app/plugins/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,13 @@
"HeuristicsSettings": {
"titles": {
"settings": "设置",
"confirmUpload": "确认上传"
"confirmUpload": "确认上传",
"enableWeights": "启用权重功能"
},
"messages": {
"acceptCsv": "如果接受,您当前的启发式将被CSV文件中的内容替换。",
"noCsvFileSelected": "未选择CSV文件。\n请选择一个以继续。"
"noCsvFileSelected": "未选择CSV文件。\n请选择一个以继续。",
"enableWeightsDescription": "允许评估者在本研究中为启发式分配权重"
},
"placeHolders": {
"importCsv": "在此导入您的CSV测试文件。"
Expand Down
33 changes: 33 additions & 0 deletions src/ux/Heuristic/components/HeuristicsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@
</h1>
<v-divider class="mb-6" />

<!-- Enable Weights Feature Toggle -->
<div class="mb-8">
<div class="d-flex align-center justify-space-between">
<div>
<h3 class="text-h6 font-weight-medium mb-1">
{{ $t('HeuristicsSettings.titles.enableWeights') }}
</h3>
<p class="text-body-2 text-grey-darken-1">
{{ $t('HeuristicsSettings.messages.enableWeightsDescription') }}
</p>
</div>
<v-switch
v-model="useWeights"
:disabled="props.isTemplate"
color="primary"
inset
class="ms-4"
/>
</div>
</div>

<v-divider class="mb-6" />

<!-- Download CSV Template -->
<div class="mb-8">
<v-btn
Expand Down Expand Up @@ -126,6 +149,16 @@ const confirmDialog = ref(false)

const test = computed(() => store.getters.test)

const useWeights = computed({
get: () => test.value.useWeights ?? false,
set: (value) => {
store.commit('SET_TEST', {
...test.value,
useWeights: value,
})
Comment on lines +154 to +158
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toggling useWeights commits to Vuex but doesn’t notify the parent view that there are unsaved changes, so the toggle can’t be persisted unless the user edits something else first. Consider emitting a change event (or otherwise setting the parent’s change flag) from this setter / switch update handler.

Copilot uses AI. Check for mistakes.
},
})

const testAnswerDocLength = computed(() => {
const doc = store.getters.testAnswerDocument
return Object.keys(doc?.heuristicAnswers ?? {}).length
Expand Down
2 changes: 2 additions & 0 deletions src/ux/Heuristic/models/HeuristicStudy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export default class HeuristicStudy extends Study {

this.testType = STUDY_TYPES.HEURISTIC
this.testWeights = params.testWeights ?? {}
this.useWeights = params.useWeights ?? false
}

toFirestore() {
return Object.assign(super.toFirestore(), {
testWeights: this.testWeights,
useWeights: this.useWeights,
})
}
}
31 changes: 25 additions & 6 deletions src/ux/Heuristic/views/EditTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
>
<v-tab>{{ $t('HeuristicsEditTest.titles.heuristics') }}</v-tab>
<v-tab>{{ $t('HeuristicsEditTest.titles.options') }}</v-tab>
<v-tab>{{ $t('HeuristicsEditTest.titles.weights') }}</v-tab>
<v-tab v-if="showWeightsTab">{{
$t('HeuristicsEditTest.titles.weights')
}}</v-tab>
<v-tab v-if="showSettingsTab">{{
$t('HeuristicsEditTest.titles.settings')
}}</v-tab>
Expand Down Expand Up @@ -57,12 +59,12 @@
@change="change = true"
/>
<WeightTable
v-if="index == 2"
v-if="showWeightsTab && index == 2"
:is-template="isTemplate"
@change="change = true"
/>
<HeuristicsSettings
v-if="showSettingsTab && index == 3"
v-if="showSettingsTab && (showWeightsTab ? index == 3 : index == 2)"
:is-template="isTemplate"
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made inside HeuristicsSettings (like toggling useWeights) currently won’t make the Save button appear because this component doesn’t emit a change event and the parent only sets change = true for other tabs. Consider emitting a change event from HeuristicsSettings when useWeights changes and wiring it up here so the user can persist the toggle.

Suggested change
:is-template="isTemplate"
:is-template="isTemplate"
@change="change = true"

Copilot uses AI. Check for mistakes.
/>
</div>
Expand All @@ -74,7 +76,7 @@
<script setup>
import ButtonSave from '@/shared/components/buttons/ButtonSave.vue'
import PageWrapper from '@/shared/views/template/PageWrapper.vue'
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue'
import HeuristicsTable from '../components/HeuristicsTable.vue'
import OptionsTable from '../components/OptionsTable.vue'
import WeightTable from '../components/weights_evaluation/WeightTable.vue'
Expand Down Expand Up @@ -103,6 +105,8 @@ const index = ref(0)
const change = ref(false)
const windowWidth = ref(window.innerWidth)
const showSettingsTab = computed(() => !props.isTemplate)
const test = computed(() => store.getters.test)
const showWeightsTab = computed(() => test.value.useWeights ?? false)
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In template preview mode, showWeightsTab is derived solely from test.useWeights. The template preview payload currently provides testWeights but not useWeights, so weights will never be shown in the preview even if the template contains weights. Either include useWeights in the template payload or derive the preview visibility from existing data (e.g., non-empty testWeights) / default to showing weights for templates.

Suggested change
const showWeightsTab = computed(() => test.value.useWeights ?? false)
const showWeightsTab = computed(() => {
if (props.isTemplate) {
const weights = props.templateTest?.testWeights
if (Array.isArray(weights)) {
return weights.length > 0
}
return !!weights
}
return test.value?.useWeights ?? false
})

Copilot uses AI. Check for mistakes.
const pageTitle = computed(() =>
props.isTemplate
? t('HeuristicsEditTest.previewPageTitle')
Expand All @@ -119,11 +123,15 @@ const tabItems = computed(() => {
const items = [
{ title: 'HEURISTICS', value: 0 },
{ title: 'OPTIONS', value: 1 },
{ title: 'WEIGHTS', value: 2 },
]

if (showWeightsTab.value) {
items.push({ title: 'WEIGHTS', value: 2 })
}

if (showSettingsTab.value) {
items.push({ title: 'SETTINGS', value: 3 })
const settingsIndex = showWeightsTab.value ? 3 : 2
items.push({ title: 'SETTINGS', value: settingsIndex })
}

return items
Expand All @@ -137,6 +145,17 @@ const handleResize = () => {
windowWidth.value = window.innerWidth
}

// Watch for changes in showWeightsTab to fix index
watch(showWeightsTab, (newVal, oldVal) => {
// If weights tab visibility changed and we're currently on or past the weights tab
if (newVal !== oldVal) {
if (!newVal && index.value > 1) {
// Weights tab is now hidden and index is on Settings (was 3, should be 2)
index.value = 2
}
}
})
Comment on lines +148 to +157
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watcher only corrects the active tab when weights are disabled. If weights are enabled while the user is on Settings (index 2 when weights are hidden), the current index will now point to the Weights tab and the UI will unexpectedly jump away from Settings. Consider updating the watcher to also handle the false→true transition (and generally clamp index to the highest available tab based on showWeightsTab/showSettingsTab).

Suggested change
// Watch for changes in showWeightsTab to fix index
watch(showWeightsTab, (newVal, oldVal) => {
// If weights tab visibility changed and we're currently on or past the weights tab
if (newVal !== oldVal) {
if (!newVal && index.value > 1) {
// Weights tab is now hidden and index is on Settings (was 3, should be 2)
index.value = 2
}
}
})
// Watch for changes in tab visibility to keep the active index valid
watch(
[showWeightsTab, showSettingsTab],
([weightsVisible, settingsVisible], [oldWeightsVisible]) => {
// Handle the case where weights are enabled while the user is on Settings.
// When weights are hidden, SETTINGS has index 2; when weights are shown,
// WEIGHTS becomes 2 and SETTINGS moves to 3. If we don't adjust here,
// the user would unexpectedly jump from SETTINGS to WEIGHTS.
if (!oldWeightsVisible && weightsVisible && settingsVisible && index.value === 2) {
index.value = 3
return
}
// In all cases, clamp the index to the highest available tab based on visibility.
let maxIndex = 1 // HEURISTICS (0) and OPTIONS (1) are always present
if (weightsVisible) {
maxIndex = 2
}
if (settingsVisible) {
maxIndex = weightsVisible ? 3 : 2
}
if (index.value > maxIndex) {
index.value = maxIndex
}
}
)

Copilot uses AI. Check for mistakes.

onMounted(() => {
if (props.isTemplate && props.templateTest) {
store.commit('SET_TEST', structuredClone(props.templateTest))
Expand Down
Loading