Realy add UCQ and int input
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
12f956f8d6
commit
b2954ccb4c
2
db.go
2
db.go
@ -94,7 +94,7 @@ CREATE TABLE IF NOT EXISTS survey_quests(
|
|||||||
title VARCHAR(255),
|
title VARCHAR(255),
|
||||||
description TEXT,
|
description TEXT,
|
||||||
placeholder VARCHAR(255),
|
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)
|
FOREIGN KEY(id_survey) REFERENCES surveys(id_survey)
|
||||||
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
|
@ -528,8 +528,10 @@ angular.module("AtsebaytApp")
|
|||||||
if (!questions[idxquestions[response.id_question]].response) {
|
if (!questions[idxquestions[response.id_question]].response) {
|
||||||
if (response.value) {
|
if (response.value) {
|
||||||
questions[idxquestions[response.id_question]].response = response;
|
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;
|
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 {
|
} else {
|
||||||
response.value.split(",").forEach(function (val) {
|
response.value.split(",").forEach(function (val) {
|
||||||
questions[idxquestions[response.id_question]]["p" + val] = true;
|
questions[idxquestions[response.id_question]]["p" + val] = true;
|
||||||
@ -547,6 +549,10 @@ angular.module("AtsebaytApp")
|
|||||||
$scope.questions.forEach(function(q) {
|
$scope.questions.forEach(function(q) {
|
||||||
if (q.kind == "text")
|
if (q.kind == "text")
|
||||||
res.push({"id_question": q.id, "value": q.value})
|
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 {
|
else {
|
||||||
var values = [];
|
var values = [];
|
||||||
Object.keys(q).forEach(function (k) {
|
Object.keys(q).forEach(function (k) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<form class="card mb-2" ng-repeat="response in responses" ng-if="!notCorrected || !response.time_scored">
|
<form class="card mb-2" ng-repeat="response in responses" ng-if="!notCorrected || !response.time_scored">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<button type="button" class="btn btn-success ml-1 float-right" ng-class="{'mt-4': $index%2}" ng-click="submitCorrection()"><svg class="bi bi-check" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15.854 5.646a.5.5 0 010 .708l-7 7a.5.5 0 01-.708 0l-3.5-3.5a.5.5 0 11.708-.708L8.5 12.293l6.646-6.647a.5.5 0 01.708 0z" clip-rule="evenodd"></path></svg></button>
|
<button type="button" class="btn btn-success ml-1 float-right" ng-class="{'mt-4': $index%2}" ng-click="submitCorrection()"><svg class="bi bi-check" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15.854 5.646a.5.5 0 010 .708l-7 7a.5.5 0 01-.708 0l-3.5-3.5a.5.5 0 11.708-.708L8.5 12.293l6.646-6.647a.5.5 0 01.708 0z" clip-rule="evenodd"></path></svg></button>
|
||||||
<p class="card-text" style="white-space: pre-line" ng-bind="response.value" ng-if="question.kind == 'text'"></p>
|
<p class="card-text" style="white-space: pre-line" ng-bind="response.value" ng-if="question.kind == 'text' || question.kind == 'int'"></p>
|
||||||
<div class="card-text" ng-if="question.kind == 'mcq'" ng-controller="ProposalsController">
|
<div class="card-text" ng-if="question.kind == 'mcq'" ng-controller="ProposalsController">
|
||||||
<div class="form-group form-check" ng-repeat="proposal in proposals">
|
<div class="form-group form-check" ng-repeat="proposal in proposals">
|
||||||
<input type="checkbox" disabled class="form-check-input" id="p{{proposal.id}}" ng-checked="response.value.indexOf(proposal.id) != -1">
|
<input type="checkbox" disabled class="form-check-input" id="p{{proposal.id}}" ng-checked="response.value.indexOf(proposal.id) != -1">
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<select class="custom-select" id="q{{qid}}kind" ng-model="question.kind">
|
<select class="custom-select" id="q{{qid}}kind" ng-model="question.kind">
|
||||||
<option value="text">Texte</option>
|
<option value="text">Texte</option>
|
||||||
|
<option value="int">Entier</option>
|
||||||
<option value="ucq">QCU</option>
|
<option value="ucq">QCU</option>
|
||||||
<option value="mcq">QCM</option>
|
<option value="mcq">QCM</option>
|
||||||
</select>
|
</select>
|
||||||
@ -79,8 +80,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<textarea class="form-control" ng-if="!question.edit && question.kind == 'text' && !survey.readonly" rows="6" ng-model="question.value" placeholder="{{ question.placeholder }}"></textarea>
|
<textarea class="form-control" ng-if="!question.edit && question.kind == 'text' && !survey.readonly" rows="6" ng-model="question.value" placeholder="{{ question.placeholder }}"></textarea>
|
||||||
|
<input class="ml-5 col-sm-2 form-control" type="number" ng-if="!question.edit && question.kind == 'int' && !survey.readonly" ng-model="question.value" placeholder="{{ question.placeholder }}">
|
||||||
<p class="card-text alert alert-secondary" style="white-space: pre-line" ng-bind="question.value" ng-if="!question.edit && survey.readonly"></p>
|
<p class="card-text alert alert-secondary" style="white-space: pre-line" ng-bind="question.value" ng-if="!question.edit && survey.readonly"></p>
|
||||||
<div class="form-group row" ng-if="question.edit && question.kind == 'text'">
|
<div class="form-group row" ng-if="question.edit && (question.kind == 'text' || question.kind == 'int')">
|
||||||
<label class="col-2 col-form-label" for="q{{qid}}placeholder">Placeholder</label>
|
<label class="col-2 col-form-label" for="q{{qid}}placeholder">Placeholder</label>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input class="form-control" id="q{{qid}}placeholder" ng-model="question.placeholder">
|
<input class="form-control" id="q{{qid}}placeholder" ng-model="question.placeholder">
|
||||||
@ -93,7 +95,7 @@
|
|||||||
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
|
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-check" ng-if="!question.edit && question.kind == 'ucq'" ng-repeat="proposal in proposals">
|
<div class="form-group form-check" ng-if="!question.edit && question.kind == 'ucq'" ng-repeat="proposal in proposals">
|
||||||
<input type="radio" class="form-check-input" name="proposals{{question.id}}" id="p{{proposal.id}}" ng-model="question['p' + proposal.id]" ng-disabled="survey.readonly">
|
<input type="radio" class="form-check-input" name="proposals{{question.id}}" id="p{{proposal.id}}" ng-model="question.value" value="{{proposal.id}}" ng-disabled="survey.readonly">
|
||||||
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
|
<label class="form-check-label" for="p{{proposal.id}}">{{ proposal.label }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row" ng-if="question.edit" ng-repeat="proposal in proposals">
|
<div class="form-group row" ng-if="question.edit" ng-repeat="proposal in proposals">
|
||||||
|
Reference in New Issue
Block a user