From 15b6315de8be2d3a285f2e52d1932d0eb3199274 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 17 May 2020 15:38:54 +0200 Subject: [PATCH] Send new survey property --- src/controllers/SurveyController.ts | 1 + src/entities/Survey.ts | 4 +++- src/helpers/SurveyHelper.ts | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/controllers/SurveyController.ts b/src/controllers/SurveyController.ts index d4e05ba..e70aae3 100644 --- a/src/controllers/SurveyController.ts +++ b/src/controllers/SurveyController.ts @@ -59,6 +59,7 @@ export class SurveyController { question: survey.question, user_choice: -1, choices: {}, + allowNewChoices: survey.allowNewChoices, } survey.choices.forEach((c) => data.choices[c.id.toString()] = this.SurveyChoiceToAPI(c)) diff --git a/src/entities/Survey.ts b/src/entities/Survey.ts index 24ecb4d..f9d322d 100644 --- a/src/entities/Survey.ts +++ b/src/entities/Survey.ts @@ -16,7 +16,8 @@ export interface SurveyBuilder { timeCreate: number; postID: number; question: string; - choices: SurveyChoice[] + choices: SurveyChoice[]; + allowNewChoices: boolean; } export class Survey implements SurveyBuilder { @@ -25,6 +26,7 @@ export class Survey implements SurveyBuilder { postID: number; question: string; choices: SurveyChoice[]; + allowNewChoices: boolean; public constructor(info: SurveyBuilder) { for (const key in info) { diff --git a/src/helpers/SurveyHelper.ts b/src/helpers/SurveyHelper.ts index 43870d7..c674fa3 100644 --- a/src/helpers/SurveyHelper.ts +++ b/src/helpers/SurveyHelper.ts @@ -256,7 +256,8 @@ export class SurveyHelper { postID: row.ID_texte, timeCreate: new Date(row.date_creation).getTime()/1000, question: row.question, - choices: [] + choices: [], + allowNewChoices: row.allow_new_choices == 1, }); }