showing quesiton-keys instead of ids

This commit is contained in:
2026-05-26 17:13:32 +02:00
parent ea3a423186
commit 25851c4b86
6 changed files with 74 additions and 12 deletions

View File

@ -2,7 +2,8 @@ import { apiGet } from '../api.js';
import { showToast } from '../app.js';
import {
isDevTestClientCode,
questionLocalKey,
questionDisplayKey,
questionGermanLabel,
testDataRowClassForClient,
} from '../test-data.js';
@ -106,7 +107,7 @@ function renderResults() {
<span style="margin-left:auto;font-size:.85rem;color:var(--text-secondary)" id="resultCount"></span>
<a id="exportCsvLink" class="btn btn-sm" href="#">Export CSV</a>
</div>
<p class="data-toolbar-hint" style="margin-top:8px">Question columns show keys; hover headers for full text. Test rows (DEV-CL-*) have a yellow background.</p>
<p class="data-toolbar-hint" style="margin-top:8px">Question columns show stable keys (e.g. country_of_origin); hover for German text. Test rows (DEV-CL-*) have a yellow background.</p>
</div>
<div class="card">
<div class="table-wrapper" id="resultsTableWrap">
@ -121,7 +122,7 @@ function renderResults() {
const qKeyList = document.getElementById('questionKeyList');
qKeyList.innerHTML = questionsDef
.map(q => `<option value="${esc(questionLocalKey(q.questionID, q.defaultText))}"></option>`)
.map(q => `<option value="${esc(questionDisplayKey(q))}"></option>`)
.join('');
document.getElementById('filterSupervisor').addEventListener('change', (e) => {
@ -202,11 +203,12 @@ function renderTableHead() {
{ key: 'completedAt', label: 'Completed' },
];
const questionCols = questionsDef.map(q => {
const qKey = questionLocalKey(q.questionID, q.defaultText);
const qKey = questionDisplayKey(q);
const german = questionGermanLabel(q);
return {
key: `q_${q.questionID}`,
label: qKey,
title: q.defaultText || qKey,
title: german || qKey,
questionID: q.questionID,
questionKey: qKey,
};
@ -446,7 +448,7 @@ function exportCSV() {
});
const headers = ['clientCode', 'coach', 'supervisor', 'status', 'sumPoints', 'completedAt',
...questionsDef.map(q => questionLocalKey(q.questionID, q.defaultText))];
...questionsDef.map(q => questionDisplayKey(q))];
const rows = clients.map(c => {
const base = [