Optional question after DashedSentence

PennController for IBEX Forums Support Optional question after DashedSentence

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4667
    adamliter
    Participant

    I’m having trouble figuring out a good way to include a question after some self-paced reading trials.

    I have something like the following. Some of the rows in the CSV file also have a value for the column Question. Some are blank, however. I only want to include the question when there is one.

    
    PennController.Template("Stimuli.csv",
      row => ["spr", "DashedSentence", {s: row.Sentence, display: "in place"},
      ]
    );
    

    I initially tried something like this:

    
    PennController.Template("Stimuli.csv",
      row => ["spr", "DashedSentence", {s: row.Sentence, display: "in place"},
            ...(row.Question !==  "" ? ["qst", "Question", {q: row.Question, as: ["დიახ", "არა"], hasCorrect: row.Answer}] : [])
      ]
    );
    

    However, this isn’t working. I think part of the issue may be that I have a new sequence, qst. I had been trying to randomize the trials with PennController.Sequence("consent", randomize("spr"), "send"), but this doesn’t account for the question. Any suggestions for how to include a question only when there is one in the CSV file while keeping the question paired with the relevant sentence when they are randomized would be really appreciated!

    • This topic was modified 4 years, 10 months ago by adamliter. Reason: formatting
    • This topic was modified 4 years, 10 months ago by adamliter.
    #4670
    Jeremy
    Keymaster

    Hi Adam,

    You were almost there: the problem indeed comes from your inserting a second label inside a single Ibex-item array, which is an illegal syntax. Your code works perfectly well if you get rid of "qst", before "Question"—if your sentences and questions are paired, they represent a single item and so you shouldn’t need a second label.

    You say that using spr only wouldn’t account for the questions: what exactly are you trying to do? If you don’t want the Question controllers (when they exist) to be paired with a respective DashedSentence controller, you should simply called Template twice on your table, first to generate the DashedSentence items, and then to generate the Question ones.

    Jeremy

    #4671
    adamliter
    Participant

    Hi Jeremy,

    Thanks for your quick response as always. Yes, just deleting the "qst" label gives me the result that I was trying to achieve. I really appreciate your help. Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.