added quesionnaire export and import

This commit is contained in:
2026-05-22 17:36:40 +02:00
parent be01b85569
commit 244fd16140
8 changed files with 523 additions and 18 deletions

View File

@ -25,15 +25,24 @@ export function germanFor(entry) {
return entry.germanText || normalizeTranslations(entry.translations)[SOURCE_LANG] || entry.key || '';
}
/** Key column label (short id for questions/options; catalog key for UI strings). */
const HEX_ID_RE = /^[a-f0-9]{32}$/i;
/** Key column label (short id or readable preview — not the app lookup key). */
export function entryDisplayKey(entry) {
if (entry.displayKey) return entry.displayKey;
const dk = entry.displayKey || '';
if (dk && !HEX_ID_RE.test(dk)) return dk;
if (entry.type === 'question' || entry.type === 'answer_option') {
const key = (entry.key || '').trim();
if (key) {
return key.length > 56 ? `${key.slice(0, 56)}` : key;
}
}
if (entry.type === 'question' || entry.type === 'answer_option') {
const id = entry.entityId || '';
const sep = id.lastIndexOf('__');
return sep >= 0 ? id.slice(sep + 2) : id;
if (sep >= 0) return id.slice(sep + 2);
}
return entry.key || '';
return dk || entry.key || '';
}
export function translationFor(entry, lang) {