Repeated practice with button and attempted history

I tried to adapt a repeated practice from tracking with input submitted to tracking with press count for this activity, and I don’t know how to fix the current streak or the longest streak in this code. Actually, I wouldn’t mind if I could just keep track of problems correct and problems attempted if that would be easier for me to understand.

Or, if someone could link an activity that has uses random numbers and a button and also tracks attempted problems, I could probably hack it altogether.
I did find this in my search for an example to borrow from, but the only example that uses a button just tracks problems correct.

Anyway, I appreciate any help or feedback.

Is this the sort of basic thing you are looking for?

Thanks for this, but I have plenty of activities that track progress with the math input.
I was needing an example that did the same tracking, but using the multiple choice submit button.

What I notice is there’s a little bit of sneaky math happening, and there are a few things to add to fix it. The prefilled list T shows an example of how a student score should look. Capturing c_urrent allows calculation of the longest streak. (The negative values cancel the prior streaks.)
A student gets a 1 for correct, and the negative value of the last streak (which is c_urrent), so if you change the otherwise 0 for correct in the note CL, as well as add a line to account for previous answers being incorrect, then it will allow the current streak to display:

correct = when addGraph.number(`c_{urrent}`)<=0 0
          when sum>0 and choice.script.choice=1 1
          when sum<0 and choice.script.choice=2 1
          otherwise numericValue(`-1*${addGraph.number(`c_{urrent}`)}`)

Then, numberList(`a_{ll}`) calls on the history for “long” which isn’t defined in the button. So in the button add:

capture("long"): addGraph.number(`l_{ongest}`)

There was also an issue with a_ll being undefined so I changed line 42:

1 Like

Thank you for your help. I made these changes, and now the only feedback it gives is “Sorry, that’s not correct.” I can’t see why it isn’t working.

feedback = when button.timeSincePress>0 and button.lastValue(“correct”)=1 “:green_circle:That’s correct. Please try another problem.”
when button.timeSincePress>0 “:yellow_circle:Sorry, that’s not correct. Try another one – you’ll do better next time!”
otherwise “”

Your correct variable is getting stuck on the first line because the current number starts at 0. I’m not sure if that line is needed, but I also haven’t looked into the code very long. I commented out the line and the activity seemed to work as intended. If it is needed, try moving it to the third position instead of the first.

Maybe change c_urrent in the graph to this?

c_urrent= {length(T)>0: total(T),0}

Sweet, it’s working as intended now. Thank you so much for all your help!

1 Like

It occurred to me I had to add a ‘zero’ option, and the buttons defaulted to a multiple choice list, which is fine, because it still works great.
But, I’m just curious–is there a way to force the choices to stay as big button tabs?

There’s a dropdown menu on the MC component to choose which style you’d like.

1 Like