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!

1 Like

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).

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