Skip to content
Merged
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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/debug/assets/react-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
<script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-Dk67JbfZ.js"></script>
<script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-CKKyGwOI.js"></script>
<script nomodule crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-DbBgSDRL.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
</body>
</html>
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/ar/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"roles_required": "الأدوار مطلوبة.",
"last_name_too_long": "يجب أن يكون الاسم الأخير 50 حرفًا أو أقل.",
"required": "مطلوب",
"survey_expired": "انتهت صلاحية الاستبيان"
"survey_expired": "انتهت صلاحية الاستبيان",
"page_not_found": "الصفحة غير موجودة"
},
"event_response": {
"details": "تفاصيل",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "اللغة",
"design_language": "لغة التصميم"
},
"error": {
"page_not_found": "الصفحة غير موجودة"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
12 changes: 12 additions & 0 deletions app/src/debug/assets/react-app/locales/de/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@
},
"email_required": "E-Mail ist erforderlich",
"error": {
"invalid_email": "Ungültige E-Mail",
"invalid_first_name": "Ungültiger Vorname",
"invalid_last_name": "Ungültiger Nachname",
"invalid_password": "Das Passwort muss mindestens 8 Zeichen lang sein und eine Mischung aus Großbuchstaben, Kleinbuchstaben und Zahlen enthalten.",
"incorrect_password": "Das Passwort ist falsch.",
"password_should_match": "Das Passwort muss übereinstimmen",
"first_name_too_long": "Der Vorname darf maximal 50 Zeichen lang sein.",
"last_name_too_long": "Der Nachname darf maximal 50 Zeichen lang sein.",
"required": "Ist erforderlich",
"at_least_one_role": "Mindestens eine Rolle muss ausgewählt werden.",
"roles_required": "Rollen sind erforderlich.",
"survey_expired": "Umfrage abgelaufen",
"page_not_found": "Seite nicht gefunden"
},
"error_title": "Fehler",
Expand Down
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/en/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"required": "Is required",
"at_least_one_role": "At least one role must be selected.",
"roles_required": "Roles are required.",
"survey_expired": "Survey Expired"
"survey_expired": "Survey Expired",
"page_not_found": "Page not found"
},
"event_response": {
"details": "Details",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Language",
"design_language": "Design Language"
},
"error": {
"page_not_found": "Page not found"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/es/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Es requerido",
"at_least_one_role": "Debe seleccionarse al menos un rol.",
"roles_required": "Los roles son requeridos.",
"survey_expired": "Encuesta Expirada"
"survey_expired": "Encuesta Expirada",
"page_not_found": "Página no encontrada"
},
"event_response": {
"details": "Detalles",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Idioma",
"design_language": "Idioma del Diseño"
},
"error": {
"page_not_found": "Página no encontrada"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/fr/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Est requis",
"at_least_one_role": "Au moins un rôle doit être sélectionné.",
"roles_required": "Les rôles sont requis.",
"survey_expired": "Sondage Expiré"
"survey_expired": "Sondage Expiré",
"page_not_found": "Page non trouvée"
},
"event_response": {
"details": "Détails",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Langue",
"design_language": "Langue du design"
},
"error": {
"page_not_found": "Page non trouvée"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/nl/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Is verplicht",
"at_least_one_role": "Ten minste één rol moet worden geselecteerd.",
"roles_required": "Rollen zijn verplicht.",
"survey_expired": "Enquête Verlopen"
"survey_expired": "Enquête Verlopen",
"page_not_found": "Pagina niet gevonden"
},
"event_response": {
"details": "Details",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Taal",
"design_language": "Ontwerptaal"
},
"error": {
"page_not_found": "Pagina niet gevonden"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/debug/assets/react-app/locales/pt/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "É obrigatório",
"at_least_one_role": "Pelo menos uma função deve ser selecionada.",
"roles_required": "As funções são obrigatórias.",
"survey_expired": "Pesquisa Expirada"
"survey_expired": "Pesquisa Expirada",
"page_not_found": "Página não encontrada"
},
"event_response": {
"details": "Detalhes",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Idioma",
"design_language": "Idioma do Design"
},
"error": {
"page_not_found": "Página não encontrada"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/main/assets/react-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
<script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-Ben82zqA.js"></script>
<script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-CySJp2Pr.js"></script>
<script nomodule crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-B9b3TFeo.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
</body>
</html>
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/ar/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"roles_required": "الأدوار مطلوبة.",
"last_name_too_long": "يجب أن يكون الاسم الأخير 50 حرفًا أو أقل.",
"required": "مطلوب",
"survey_expired": "انتهت صلاحية الاستبيان"
"survey_expired": "انتهت صلاحية الاستبيان",
"page_not_found": "الصفحة غير موجودة"
},
"event_response": {
"details": "تفاصيل",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "اللغة",
"design_language": "لغة التصميم"
},
"error": {
"page_not_found": "الصفحة غير موجودة"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/assets/react-app/locales/de/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@
},
"email_required": "E-Mail ist erforderlich",
"error": {
"invalid_email": "Ungültige E-Mail",
"invalid_first_name": "Ungültiger Vorname",
"invalid_last_name": "Ungültiger Nachname",
"invalid_password": "Das Passwort muss mindestens 8 Zeichen lang sein und eine Mischung aus Großbuchstaben, Kleinbuchstaben und Zahlen enthalten.",
"incorrect_password": "Das Passwort ist falsch.",
"password_should_match": "Das Passwort muss übereinstimmen",
"first_name_too_long": "Der Vorname darf maximal 50 Zeichen lang sein.",
"last_name_too_long": "Der Nachname darf maximal 50 Zeichen lang sein.",
"required": "Ist erforderlich",
"at_least_one_role": "Mindestens eine Rolle muss ausgewählt werden.",
"roles_required": "Rollen sind erforderlich.",
"survey_expired": "Umfrage abgelaufen",
"page_not_found": "Seite nicht gefunden"
},
"error_title": "Fehler",
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/en/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"required": "Is required",
"at_least_one_role": "At least one role must be selected.",
"roles_required": "Roles are required.",
"survey_expired": "Survey Expired"
"survey_expired": "Survey Expired",
"page_not_found": "Page not found"
},
"event_response": {
"details": "Details",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Language",
"design_language": "Design Language"
},
"error": {
"page_not_found": "Page not found"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/es/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Es requerido",
"at_least_one_role": "Debe seleccionarse al menos un rol.",
"roles_required": "Los roles son requeridos.",
"survey_expired": "Encuesta Expirada"
"survey_expired": "Encuesta Expirada",
"page_not_found": "Página no encontrada"
},
"event_response": {
"details": "Detalles",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Idioma",
"design_language": "Idioma del Diseño"
},
"error": {
"page_not_found": "Página no encontrada"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/fr/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Est requis",
"at_least_one_role": "Au moins un rôle doit être sélectionné.",
"roles_required": "Les rôles sont requis.",
"survey_expired": "Sondage Expiré"
"survey_expired": "Sondage Expiré",
"page_not_found": "Page non trouvée"
},
"event_response": {
"details": "Détails",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Langue",
"design_language": "Langue du design"
},
"error": {
"page_not_found": "Page non trouvée"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/nl/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "Is verplicht",
"at_least_one_role": "Ten minste één rol moet worden geselecteerd.",
"roles_required": "Rollen zijn verplicht.",
"survey_expired": "Enquête Verlopen"
"survey_expired": "Enquête Verlopen",
"page_not_found": "Pagina niet gevonden"
},
"event_response": {
"details": "Details",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Taal",
"design_language": "Ontwerptaal"
},
"error": {
"page_not_found": "Pagina niet gevonden"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/assets/react-app/locales/pt/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"required": "É obrigatório",
"at_least_one_role": "Pelo menos uma função deve ser selecionada.",
"roles_required": "As funções são obrigatórias.",
"survey_expired": "Pesquisa Expirada"
"survey_expired": "Pesquisa Expirada",
"page_not_found": "Página não encontrada"
},
"event_response": {
"details": "Detalhes",
Expand Down Expand Up @@ -354,9 +355,6 @@
"language": "Idioma",
"design_language": "Idioma do Design"
},
"error": {
"page_not_found": "Página não encontrada"
},
"responses_export": {
"format_csv": "CSV",
"format_excel": "Excel",
Expand Down
24 changes: 18 additions & 6 deletions app/src/main/java/com/qlarr/app/ui/survey/EMNavProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.qlarr.surveyengine.model.SurveyLang
import com.qlarr.surveyengine.model.exposed.ColumnName
import com.qlarr.surveyengine.model.exposed.NavigationDirection
import com.qlarr.surveyengine.model.exposed.NavigationIndex
import com.qlarr.surveyengine.model.exposed.NavigationMode
import com.qlarr.surveyengine.model.exposed.SurveyMode
import com.qlarr.surveyengine.scriptengine.engineScript
import com.qlarr.surveyengine.usecase.NavigationUseCaseWrapper
Expand Down Expand Up @@ -86,7 +85,7 @@ class EMNavProcessor(
}

private fun getPrefillValues(validationJsonOutput: ValidationJsonOutput): Map<String, Any> {
val prefillQuestionCodes =
val prefillQuestionsCodes =
validationJsonOutput.survey
.get("groups")
?.asSequence()
Expand All @@ -95,17 +94,30 @@ class EMNavProcessor(
}?.filter { question ->
question.get("prefill")?.asBoolean() == true
}?.mapNotNull { question ->
question.get("code")?.asText()?.let { "$it.value" }
}?.toList() ?: emptyList()
question.get("code")?.asText()
}?.toList() ?: return emptyMap()

if (prefillQuestionCodes.isEmpty()) return emptyMap()
if (prefillQuestionsCodes.isEmpty()) return emptyMap()

val prefillValueKeys =
validationJsonOutput.schema
.filter {
it.columnName == ColumnName.VALUE
}.filter { responseField ->
prefillQuestionsCodes.any {
responseField.componentCode == it ||
responseField.componentCode.startsWith("${it}A")
Copy link
Copy Markdown
Collaborator

@askoura askoura Jan 12, 2026

Choose a reason for hiding this comment

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

we can simplify this to responseField.componentCode.startsWith(it)

this is safe, and it is incredibly stable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

what if one code is Q123 and other is Q1234?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you are right 🙇

}
}.map { "${it.componentCode}.value" }

if (prefillValueKeys.isEmpty()) return emptyMap()

return runBlocking {
qlarrDb
.responseDao()
.getLastResponse(survey.id)
?.values
?.filterKeys { it.endsWith(".value") && it in prefillQuestionCodes }
?.filterKeys { it in prefillValueKeys }
?: emptyMap()
}
}
Expand Down