One feedback for multiple answers

There is currently an issue with putting answer boxes inside table cells where the check work button runs into the next cell instead of staying within a single cell when embedded within a PreTeXt book, but the same thing can be seen in the side-by-side editor/preview viewer on beta as well. The actual activity viewer is wider and this issue doesn’t occur.

To help this, I’m trying to use sectionWideCheckWork but with giving feedback as to which answers are right or wrong, which is pretty much opposite of its usual use.

I know how to have individual feedback elements for each answer, but that stacks up vertically. What I would like is to have a single feedback element with a message like: The following answers are incorrect: A(1), A(4), A(6). But I don’t know how to do that.

Here’s what I currently have (parts c and d are the ones prompting this): Doenet

Thanks for any help!

Chrissy

No overly pretty, but you could do something like this:

      <setup>
        <boolean name="A0wrong">
          $A0.creditAchieved != 1 and $A0.responseHasBeenSubmitted
        </boolean>
        <boolean name="A1wrong">
          $A1.creditAchieved != 1 and $A1.responseHasBeenSubmitted
        </boolean>
        <boolean name="A2wrong">
          $A2.creditAchieved != 1 and $A2.responseHasBeenSubmitted
        </boolean>
        <boolean name="A3wrong">
          $A3.creditAchieved != 1 and $A3.responseHasBeenSubmitted
        </boolean>
        <boolean name="A4wrong">
          $A4.creditAchieved != 1 and $A4.responseHasBeenSubmitted
        </boolean>
        <boolean name="A5wrong">
          $A5.creditAchieved != 1 and $A5.responseHasBeenSubmitted
        </boolean>
        <boolean name="A6wrong">
          $A6.creditAchieved != 1 and $A6.responseHasBeenSubmitted
        </boolean>
      </setup>
      <feedback 
  condition="$A0wrong or $A1wrong or $A2wrong or $A3wrong or $A4wrong or $A5wrong or $A6wrong">
    Your answer(s) are incorrect for:
        <asList>
          <conditionalContent condition="$A0wrong"><m>A(0)</m></conditionalContent>
          <conditionalContent condition="$A1wrong"><m>A(1)</m></conditionalContent>
          <conditionalContent condition="$A2wrong"><m>A(2)</m></conditionalContent>
          <conditionalContent condition="$A3wrong"><m>A(3)</m></conditionalContent>
          <conditionalContent condition="$A4wrong"><m>A(4)</m></conditionalContent>
          <conditionalContent condition="$A5wrong"><m>A(5)</m></conditionalContent>
          <conditionalContent condition="$A6wrong"><m>A(6)</m></conditionalContent>
        </asList>
      </feedback>

This works great, thank you!

I think coloring the outline of the answer boxes would still be a nice addition.

Chrissy

Actually, followup question: what if there is no section, problem, or list item? A table is a peer of p, and so it didn’t work to put the sectionWideCheckWork on a random p (no effect), and it didn’t work to put it on the table, tabular, or row either (error that it was not an allowed attribute).

Edit: I think I know… mathInputs for the answer boxes and then a single answer. It almost is perfect as I have it now, except for one weird thing. If I had something wrong and hit Check Work, it immediately scores it and shows the feedback, as desired. If I make it all correct after that and hit Check Work, the feedback goes away, but it doesn’t get scored; it still says Check Work. I have to hit it a second time to see the Correct. If I enter everything correctly in 1 attempt, it scores it fine. Only when there was feedback showing and then it’s all correct do I get the hiccup where I have to press Check Work twice.

I think maybe it works fine in the Activity Viewer, just not the side-by-side editor/previewer?

So I think I’m all set actually! I’ll leave this here anyway in case someone has ideas for how I could have done it better. :slight_smile:

I can’t reproduce the behavior where you have to click Check Work twice. If you consistently get can that flaw to happen, I’d like to be able to reproduce it so that I can figure out the cause. If something is getting recalculated when it shouldn’t, it can revert a submitted button back to Check Work.

I only put sectionWideCheckWork on sectioning component (like <section>, <subSection>, <problem>, <exercise>, etc.), <p>, <li>, <span>, and <div>. In most cases, you can put a <div> (for a block component like a <table>) or a <span> (for inline components) and then add the sectionWideCheckWork to that.

I’m open to adding sectionWideCheckWork to more components if it is helpful.

Also, if you put everything you don’t want to display in one or more <setup> tags, then it will save you the hassle of putting the hide attribute on a lot of components.

I only saw the weird Check Work hiccup inside the side-by-side editor on beta. It seems fine in the viewer, and in PreTeXt on Runestone.

I didn’t write the first part of the problem, and I don’t really understand how/why it was set up like that. There’s conditional content and hide, all within a setup. But it works, so I wasn’t going to mess with it.

You’re saying I could have put a div around the table, and then the sectionWideCheckWork on the div? Good to know, thank you!

That’s correct, putting in a div it around should work.

I was reading the documentation looking for something else and saw things about referencesAreResponses and considerAsResponses. Should I be in the habit of using that if I’m separating the answer box from the check work button using mathInput and then a separate answer and award?

What prompted this is that there are instances when Matt has asked students to fill in part of an integrand, and I think it’s better if the check work button doesn’t also appear inside the integral but rather appears after it, but I did the same thing on the exercise mentioned here.

referencesAreResponse and considerAsResponses are ways to tell Doenet which quantities are the responses. If you don’t use either of them, it will consider all references inside the <answer> as a response.

So for this example

<p>
    Enter <math name="a">x</math>: <mathInput name="b"/>
    <answer name="ans"><award><when>$b = $a</when></award></answer>
</p>

it will determine that both $a and $b are the response. (On beta.doenet.org, you can look at the Submitted Responses tab at the bottom of the editor to see what Doenet has determined are the responses.)

You could fix that by adding referencesAreResponses="$b" to the <award>. Then the correct answer $a will no longer be reported as a response.

If you add forAnswer="$ans" to the <mathInput name="b"/>, I would like that to also work to let Doenet know that the response is $b. But, that ends up being harder to figure out how to work (given how Doenet works internally). It’ll take me some time to see if I can determine how to do that. I assume that what people would want, though.