1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Send new survey property

This commit is contained in:
Pierre HUBERT 2020-05-17 15:38:54 +02:00
parent 836f6783a0
commit 15b6315de8
3 changed files with 6 additions and 2 deletions

View File

@ -59,6 +59,7 @@ export class SurveyController {
question: survey.question, question: survey.question,
user_choice: -1, user_choice: -1,
choices: {}, choices: {},
allowNewChoices: survey.allowNewChoices,
} }
survey.choices.forEach((c) => data.choices[c.id.toString()] = this.SurveyChoiceToAPI(c)) survey.choices.forEach((c) => data.choices[c.id.toString()] = this.SurveyChoiceToAPI(c))

View File

@ -16,7 +16,8 @@ export interface SurveyBuilder {
timeCreate: number; timeCreate: number;
postID: number; postID: number;
question: string; question: string;
choices: SurveyChoice[] choices: SurveyChoice[];
allowNewChoices: boolean;
} }
export class Survey implements SurveyBuilder { export class Survey implements SurveyBuilder {
@ -25,6 +26,7 @@ export class Survey implements SurveyBuilder {
postID: number; postID: number;
question: string; question: string;
choices: SurveyChoice[]; choices: SurveyChoice[];
allowNewChoices: boolean;
public constructor(info: SurveyBuilder) { public constructor(info: SurveyBuilder) {
for (const key in info) { for (const key in info) {

View File

@ -256,7 +256,8 @@ export class SurveyHelper {
postID: row.ID_texte, postID: row.ID_texte,
timeCreate: new Date(row.date_creation).getTime()/1000, timeCreate: new Date(row.date_creation).getTime()/1000,
question: row.question, question: row.question,
choices: [] choices: [],
allowNewChoices: row.allow_new_choices == 1,
}); });
} }