generated from VLADIMIR/template
add questions
This commit is contained in:
@@ -49,6 +49,7 @@ func mapStory(o *storytelling.Story) *proto.Story {
|
||||
return &proto.Story{
|
||||
Introduction: mapIntroduction(o.Introduction),
|
||||
Places: mapPlaces(o.Places),
|
||||
Questions: mapQuestions(o.Questions),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,3 +198,33 @@ func convertIntroduction(o *proto.Introduction) *storytelling.Introduction {
|
||||
Audio: o.Audio,
|
||||
}
|
||||
}
|
||||
|
||||
func mapQuestions(o []*storytelling.Question) []*proto.Question {
|
||||
res := make([]*proto.Question, 0, len(o))
|
||||
for _, item := range o {
|
||||
res = append(res, mapQuestion(item))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func mapQuestion(o *storytelling.Question) *proto.Question {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return &proto.Question{
|
||||
Code: o.Code,
|
||||
Text: o.Text,
|
||||
Answer: o.Answer,
|
||||
}
|
||||
}
|
||||
|
||||
func convertQuestion(o *proto.Question) *storytelling.Question {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return &storytelling.Question{
|
||||
Code: o.Code,
|
||||
Text: textFormatter.FormatText(o.Text),
|
||||
Answer: textFormatter.FormatText(o.Answer),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user