diff --git a/db.go b/db.go index 66dde25..7873411 100644 --- a/db.go +++ b/db.go @@ -94,7 +94,7 @@ CREATE TABLE IF NOT EXISTS survey_quests( title VARCHAR(255), description TEXT, placeholder VARCHAR(255), - kind ENUM('text', 'ucq', 'mcq') NOT NULL, + kind ENUM('text', 'int', 'ucq', 'mcq') NOT NULL, FOREIGN KEY(id_survey) REFERENCES surveys(id_survey) ) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin; `); err != nil { diff --git a/htdocs/js/atsebayt.js b/htdocs/js/atsebayt.js index 024ae60..a8bbb2f 100644 --- a/htdocs/js/atsebayt.js +++ b/htdocs/js/atsebayt.js @@ -528,8 +528,10 @@ angular.module("AtsebaytApp") if (!questions[idxquestions[response.id_question]].response) { if (response.value) { questions[idxquestions[response.id_question]].response = response; - if (questions[idxquestions[response.id_question]].kind == "text") { + if (questions[idxquestions[response.id_question]].kind == "text" || questions[idxquestions[response.id_question]].kind == "ucq") { questions[idxquestions[response.id_question]].value = response.value; + } else if (questions[idxquestions[response.id_question]].kind == "int") { + questions[idxquestions[response.id_question]].value = parseInt(response.value); } else { response.value.split(",").forEach(function (val) { questions[idxquestions[response.id_question]]["p" + val] = true; @@ -547,6 +549,10 @@ angular.module("AtsebaytApp") $scope.questions.forEach(function(q) { if (q.kind == "text") res.push({"id_question": q.id, "value": q.value}) + else if (q.kind == "int") + res.push({"id_question": q.id, "value": "" + q.value}) + else if (q.kind == "ucq") + res.push({"id_question": q.id, "value": q.value}) else { var values = []; Object.keys(q).forEach(function (k) { diff --git a/htdocs/views/correction.html b/htdocs/views/correction.html index f2b69e4..eeeb88b 100644 --- a/htdocs/views/correction.html +++ b/htdocs/views/correction.html @@ -22,7 +22,7 @@
-

+

diff --git a/htdocs/views/survey.html b/htdocs/views/survey.html index 31bbc3b..3f4d845 100644 --- a/htdocs/views/survey.html +++ b/htdocs/views/survey.html @@ -72,6 +72,7 @@
@@ -79,8 +80,9 @@
+

-
+
@@ -93,7 +95,7 @@
- +