Kind of unsure about this… i’m trying to use Capture to do some logic.
If something is correct it captures a 1 and if it’s not correct it’s a 0.
Simplified example to compare what works and what doesn’t: I’m asking someone to enter the number 5, and doing the logic like this:
capture("correctA"): when this.script.correctA 1 otherwise 0
capture("correctB"): when this.script.correctB 1 otherwise 0
correctA = this.numericValue=5
correctB = this.numericValue=5 and this.submitted
correctA does what i want it to do, and successfully records 1 when a value of 5 is entered, but 0 when something else is entered.
correctB does not. It always records a 0, never a 1.
Here’s a test Activity with this happening: capture conditional • Activity Builder by Desmos
Not a helpful answer, but here are my thoughts:
I would have guessed that correctB would work the way you wanted. However, it seems like the capture is happening before it recognizes the “submitted” status of the input. I can confirm that your compound logic setup looks valid, but instead of calling
this.script.correctA you can just call on
I can’t think of any reason to have the value of the capture based off of whether something is submitted because the submission is already the trigger for the capture. I’m curious what you’re up to.
Yeah i’ve come to the same conclusions but what is puzzling to me is more that by including .submitted it seems to not only, say not make a difference, but to actually invalidate the capture.
I can accept - sort of(not really) - that .submitted doesn’t affect capture, but where i’m struggling to understand is why then calling .submitted seemingly undoes the capture, so to speak.
As to what i’m going for, i’m looking to create an infinite questions generation template that not only does all the correctness checking in the moment, but allows for capturing total correct, etc. all on one screen - and doing some other validation on the teacher summary side to show checks if/when a certain number are correct. So… kind of replicating what I might do for an entire Activity but have it all happen on one screen.
My thought was to do a list, total that list with 1’s for correct answers and zeroes for incorrect and simultaneously get a ‘current correct’ readout for each question variation.
Make sense? Might be i’m missing a good way of doing this though.
I don’t think that calling .submitted undoes the capture. It just registers as false because the capture is happening before
.submitted becomes true. I don’t know why that would be the case, but it would explain what is happening. I believe that captures happen before
.submitCount gets incremented, so it’s not unreasonable to think that the capture happens before
.submitted gets toggled to true.
Your idea of capturing the correctness as a list of 0s and 1s is good. That’s How I did it. I suppose you could also capture the problem type (numbered 1 through n) as a list so that the same indices are shared. Then you could use some math in the calculator to check how many of each problem type are correct.
Take a look at screen 2 of the activity Equivalent Fractions • Activity Builder by Desmos to see how I built an infinite question generator using two buttons. To succeed on the screen, students have to answer 10 consecutive questions correctly. It’s not quite as elaborate as what you are trying to accomplish, but it might spark some ideas. (Sorry if the code is a bit of a mess.)
Ok thanks for that. That lines up with my thinking as well.
Going to have a look at that Activity - thanks for sharing!
I gotta come back to this because now I’m finding things are more contradictory than ever.
Here’s what the docs say about capture:
Sets a variable you want to capture every time the expression input is submitted. (Often times this is the numeric value of the expression input.) Retrieve the history of that variable later using the history source.
We know that’s not true because of the results from above. So far, so confusing.
However, what’s even more strange is that capture fails to do anything at all if the Submit button is hidden. Found that out by experimenting(and I added a screen to that test activity i posted to show this behaviour).
So… .submitted seems to both not matter at all and yet the button to which it’s assigned seems to be necessary. Colour me confused!