mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Can set new survey attribute
This commit is contained in:
parent
15b6315de8
commit
c4a507e25c
@ -267,7 +267,8 @@ export class PostsController {
|
|||||||
survey = new NewSurvey({
|
survey = new NewSurvey({
|
||||||
question: h.postString("question"),
|
question: h.postString("question"),
|
||||||
userID: h.getUserId(),
|
userID: h.getUserId(),
|
||||||
choices: h.postString("answers").split("<>")
|
choices: h.postString("answers").split("<>"),
|
||||||
|
allowNewChoices: h.postBool("allowNewAnswers", false),
|
||||||
})
|
})
|
||||||
|
|
||||||
if(survey.choices.length < 2)
|
if(survey.choices.length < 2)
|
||||||
|
@ -8,7 +8,8 @@ export interface NewSurveyBuilder {
|
|||||||
postID?: number,
|
postID?: number,
|
||||||
userID: number,
|
userID: number,
|
||||||
question: string,
|
question: string,
|
||||||
choices: Array<string>
|
choices: Array<string>,
|
||||||
|
allowNewChoices: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NewSurvey implements NewSurveyBuilder {
|
export class NewSurvey implements NewSurveyBuilder {
|
||||||
@ -16,6 +17,7 @@ export class NewSurvey implements NewSurveyBuilder {
|
|||||||
userID: number;
|
userID: number;
|
||||||
question: string;
|
question: string;
|
||||||
choices: string[];
|
choices: string[];
|
||||||
|
allowNewChoices: boolean;
|
||||||
|
|
||||||
public constructor(info: NewSurveyBuilder) {
|
public constructor(info: NewSurveyBuilder) {
|
||||||
for (const key in info) {
|
for (const key in info) {
|
||||||
|
@ -42,7 +42,8 @@ export class SurveyHelper {
|
|||||||
ID_utilisateurs: survey.userID,
|
ID_utilisateurs: survey.userID,
|
||||||
ID_texte: survey.postID,
|
ID_texte: survey.postID,
|
||||||
date_creation: mysql_date(),
|
date_creation: mysql_date(),
|
||||||
question: survey.question
|
question: survey.question,
|
||||||
|
allow_new_choices: survey.allowNewChoices ? 1 : 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Process choices
|
// Process choices
|
||||||
|
Loading…
Reference in New Issue
Block a user