Feature/4393 poll with visible participant p1

This commit is contained in:
Frank Rotermund
2023-05-25 13:52:30 +00:00
committed by JanNiklas Grabowski
parent b76b4e0803
commit 902b529245
18 changed files with 71 additions and 5 deletions
@@ -50,7 +50,8 @@ class PollEditFormViewModel: PollEditFormViewModelType, PollEditFormViewModelPro
bindings: PollEditFormViewStateBindings(
question: PollEditFormQuestion(text: parameters.pollDetails.question, maxLength: Constants.maxQuestionLength),
answerOptions: parameters.pollDetails.answerOptions.map { PollEditFormAnswerOption(text: $0, maxLength: Constants.maxAnswerOptionLength) },
type: parameters.pollDetails.type
type: parameters.pollDetails.type,
showParticipants: parameters.pollDetails.showParticipants
)
)
@@ -100,11 +101,13 @@ class PollEditFormViewModel: PollEditFormViewModelType, PollEditFormViewModelPro
// MARK: - Private
private func buildPollDetails() -> EditFormPollDetails {
EditFormPollDetails(type: state.bindings.type,
question: state.bindings.question.text.trimmingCharacters(in: .whitespacesAndNewlines),
answerOptions: state.bindings.answerOptions.compactMap { answerOption in
let text = answerOption.text.trimmingCharacters(in: .whitespacesAndNewlines)
return text.isEmpty ? nil : text
})
},
showParticipants: state.bindings.showParticipants)
}
}