@@ -193,6 +193,12 @@ pub enum Question {
193193 description_text : String ,
194194 ranking : RankingChoices ,
195195 } ,
196+ #[ serde( rename = "input_list" ) ]
197+ InputList {
198+ question_text : String ,
199+ description_text : String ,
200+ input_list : InputListInputs ,
201+ } ,
196202}
197203
198204impl Question {
@@ -203,6 +209,7 @@ impl Question {
203209 Self :: ChoiceTable { question_text, .. } => question_text,
204210 Self :: RatingScale { question_text, .. } => question_text,
205211 Self :: Ranking { question_text, .. } => question_text,
212+ Self :: InputList { question_text, .. } => question_text,
206213 } )
207214 }
208215
@@ -220,7 +227,12 @@ impl Question {
220227 Self :: RatingScale {
221228 description_text, ..
222229 } => description_text,
223- Self :: Ranking { description_text, .. } => description_text,
230+ Self :: Ranking {
231+ description_text, ..
232+ } => description_text,
233+ Self :: InputList {
234+ description_text, ..
235+ } => description_text,
224236 } )
225237 }
226238
@@ -315,7 +327,7 @@ pub struct Settings {
315327
316328#[ derive( Debug , Deserialize ) ]
317329pub struct RankingChoices {
318- choices : Vec < RankingChoice > ,
330+ choices : Vec < ChoiceWithLabel > ,
319331}
320332
321333impl RankingChoices {
@@ -334,10 +346,30 @@ impl RankingChoices {
334346}
335347
336348#[ derive( Debug , Deserialize ) ]
337- pub struct RankingChoice {
349+ pub struct ChoiceWithLabel {
338350 label : String ,
339351}
340352
353+ #[ derive( Debug , Deserialize ) ]
354+ pub struct InputListInputs {
355+ inputs : Vec < ChoiceWithLabel > ,
356+ }
357+
358+ impl InputListInputs {
359+ pub fn as_strs ( & self ) -> impl Iterator < Item = String > + ' _ {
360+ self . inputs
361+ . iter ( )
362+ . map ( |c| normalize_surveyhero_text ( c. label . as_str ( ) ) )
363+ }
364+
365+ pub fn mismatched_answers < ' a > ( & ' a self , answers : & ' a [ & str ] ) -> Vec < ( String , & ' a str ) > {
366+ self . as_strs ( )
367+ . zip ( answers. iter ( ) . map ( |s| normalize_markdown_text ( s) ) )
368+ . filter ( |( s1, s2) | s1 != s2)
369+ . collect ( )
370+ }
371+ }
372+
341373#[ derive( Debug , Deserialize ) ]
342374pub struct Surveys {
343375 pub surveys : Vec < Survey > ,
0 commit comments