Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Sort survey questions

Robin Dekkers7c684df464bf
diff --git a/ui/component/or-survey/src/index.ts b/ui/component/or-survey/src/index.ts
index 812840ba9..033d9405e 100644
--- a/ui/component/or-survey/src/index.ts
+++ b/ui/component/or-survey/src/index.ts
@@ -454,12 +454,13 @@ class OrSurvey extends LitElement {
manager.rest.api.AssetResource.queryPublicAssets(questionQuery).then((response) => {
if (response && response.data) {
const questions = response.data;
+ questions.sort((a, b) => a.attributes && b.attributes ? a.attributes.order.value - b.attributes.order.value : 0);
this.questions = [...questions];
if(this.survey){
this.questions = filter(this.questions, ['parentId', this.survey.id]);
}
-
+
this.checkButtons();
this.requestUpdate();
}