How to show correctness when students match graph with correct function

I am hoping someone can provide me with the correct CL so that when students enter the correct function that matches the graph, that they not only see that it is correct because their graph goes directly over top of the given graph, but also that when they press SUBMIT that they can see some thing like 'Correct :white_check_mark:" show up. If they got it incorrect, then the message can say “Please Try Again”. In addition, I would like to be able to see whether they got the problem correct on my dashboard by seeing either an X or a check mark show up.

Here is my activity: Matching a graph • Activity Builder by Desmos

Thank you for your assistance!

2 Likes

You’ll need to add to all three CL codes:

  1. This will also result in a check on the dashboard. Put this in the Graph CL:
readOnly: true
  1. Put this in the Note CL:
feedback = when not(input1.submitted) "" otherwise when input1.script.check "Correct ✅" otherwise "Please Try Again"
content: feedback
  1. Put this in the Math Input CL:
yeq = simpleFunction(this.latex)
check= yeq.evaluateAt(0)= 5 and yeq.evaluateAt(1)= 3 and yeq.evaluateAt(2)= 5
correct: check
1 Like

Thank you so much…that worked great!

Hi, I’m sharing a similar problem, in particular in many of my activities I fail to make the dashboard check appear as expected.

Here an example

Other elements in the activity seems to show that the check variable is correctly set, only dashboard fails to update.

Can anyone help? Thank you!

You also need to have a correct sink in your input, or “readOnly: true”. The correct checkmark on the dashboard requires all components that can have a correct sink be correct, or be marked readOnly: true.

It’s also impossible to have a checkmark for screens with a text input, or explain prompt, as it’s expected they require teacher review.

Thank you very much for this info, which describe the behaviour of the mechanism in a complete way which I didn’t know.

Anyway I tried to modify my example taking into consideration your hints but there is still a problem I’m not able to identify.

The only way I found (randomly) to get something different from the dash, it was the X wrong sign I got if input was not correct and graph was

[which I obtained simply writing

is_input_correct = not(this.submitted)

in the input element.]

If Graph is not correct and input is, however, the usual dash appears.
In all other combinations/trials, I was not able to get anything different from the dash.

Replacing the code in the input element with

readOnly: true

was of no use.

Thank you in advance for any hint.

In the graph component, delete this section of code (it will get moved to the input component and modified).

is_correct = this.number(`O_k`)>0
correct: is_correct

Then add readOnly: true to the graph component.

In the input component, delete what you have there and use this instead.

is_correct = graph.number(`O_k`)=1
correct: is_correct

Like Daniel mentioned, the graph component is not getting interacted with so you want to mark it as readOnly. The input is getting the interaction, but the O_k function is doing the checking, so that’s why we are using that function in the input component to check for correctness.

You give me credit, but I neglected to mention that! I do think it’s best practice to always have your correct sinks live where that interaction occurs (even when all components receive interaction).

Great!
Really clear and it sounds quite logic.
Thank you so much!
Ilic

Hi y’all. I know this is an old thread, but I’m wondering if someone could clarify what’s going on in a graph component if I explicitly say

readOnly: false  # ie, DO use this component for correctness 
correct: true    # ie, I don't care about user input, just mark the screen correct

When I’ve done this (and also ensured that all other components with a “correct” sink are set “readOnly: true”), I have found that I DO NOT get a “checkmark”. Instead, what I see is a grey circle indicating correctness needs to be visually handled by me. But wait. I explicitly wrote CL to say “correct: true”. I expect a checkmark! :slight_smile:

Clearly my mental model of what’s going on is not correct. Can anyone enlighten me?


Aside:

Hard-coding correct to be true is what I did to debug the no-checkmark problem I was seeing. I used it to rule out any error in my correctness-calculation-logic.

My “readOnly: true” example above is just my minimal working example that made me realize my understanding of screen correctness is broken.

Hi David, here are my thoughts - maybe someone with more expertise can weigh in and we’ll both be enlightened!

  • small note: if you have correct: true, you won’t also need the readOnly: false because CL already knows to do a correctness check (which in this minimal example is just to mark it correct).

  • in your example about the graph, does the graph require any interaction? Desmos requires a component to be interacted with before the correctness check kicks in. If the graph is static and doesn’t allow any interaction, then try marking the graph as readOnly: true and put the correctness check in another component that students will interact with.

Hope that helps!

You’ve addressed the source of my puzzlement! My graph in fact has NO user interaction. It’s driven automatically from CL code based on content in other components.

Thanks a lot.

With respect to your small note, since so much of CL is under documented (eg, a graph’s “content” sink doesn’t really do anything unless the graph has user interaction :wink: I frequently find myself writing odd code in hopes that maybe that will do it.

But really, thanks for the help.

It’s best practice to put the correct sink wherever that student input occurs. Even if it’s actually validated/calculated in the graph, you can still reference the appropriate variable in the component students are interacting with.