WeBWorK Problems

Passing GeoGebra values to WeBWorK as "correct" answers?

Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Number of replies: 15
Greetings,

We are making tentative steps on the two-way communication between a GeoGebra applet embedded within a WeBWorK problem...

Since the GeoGebra applet we are using gives student feedback in terms of an accuracy score,an integer on [0 to 100], how can javascript indicate to WeBWorK that this single value that is passed is "correct" since WeBWorK had no inputs to the applet to begin with?

We can get the student's accuracy value to be passed to WeBWorK from GeoGebra, and we can use a conditional statement to pass on the number one for a comparison with a WeBWorK answer variable to see if this is the correct value. This will cause the green field to light up as "correct". But the student will only see the number one as their entered value and the number one as the "correct value" in WeBWorK. However the student wont see "82" or "78" as the score that they achieved in the applet which is our intention.

So this leads to two Questions:
1.) How can a value passed to WeBWorK from a GeoGebra applet be read as "correct", or at least the score that a student is willing to accept.
2.) If the score is considered correct, does this prevent further attempts at improving one's score by re-attempting the problem with a new function in the embedded applet?

Thanks for any consideration....

Tim

## A simple testing of embedding GeoGebra applet
## Using two-way communication of values between the platforms
## of GeoGebra and WeBWorK
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGinfo.pl",
"unionTables.pl",
"AppletObjects.pl",
#"source.pl",
"PGcourse.pl",
);
TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("Numeric");

#################################
# Set up problem for random variables
# Set parameters for a circle
#################################
#$a = random(0,7,1);
$a = 7;
$b = random(-3,2,1);
#$ans70 = String("NotBad");
$answ = Compute("$b");
$answer = Compute("1");
$accin = random(0,100,1);
$acc = random(0,100,1);
$wrg = "Nope!";
######################################
# Create link to applet:
###################################
# You can name your applet (anything reasonable :-) )
# Adjust the height and width as desired
# Paste the geogebra parameters in at the bottom of the page just above the
# command end command
# so that they don't get in the way
###################################

$appletName = "numberTest";
$applet = GeogebraWebApplet(
code => "geogebra.GeoGebraApplet",
archive => "geogebra.jar",
codebase => findAppletCodebase("geogebra.jar"),
appletName => $appletName,
appletId => $appletName,
submitActionAlias => 'getAppletValues', # default actionAlias
initializeActionAlias => '', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
setConfigAlias => '',
getConfigAlias => '',
returnFieldName => '',
width => 700, # may want to modify width
height => 300, # may want to modify height
# mayscript => "true",
debugMode => 0, # set debugMode to 0 for no debug
# to 1 to make xml representation visible
# to 2 to add alerts detailing progression
# through the applet
onInit => 'ggbOnInit',
type => 'geogebraweb',
# "submitActionScript" takes the student submission in a geogebra applet
# and passes it to webwork: getQE() is a webwork call for geogebra submission?
# A general case of retrieving all values vs specific cases "a" and "b"
# is shown below...
submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },
selfLoading => 1,
params => GEOGEBRA_PARAMS(), # paste parameters in
);

#######################################################
#
# For setting initial values in GeoGebra from WeBWorK
# Uses JavaScript interface to GeoGebra.
# hotfix #354 via Mike Gage was attempted and disgarded below to no affect:
# // Affixed protective <div>s to prevent overlapping text
#############################################################
TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setAppletCoefficients() {
var applet=getApplet("$appletName"); // alert("Updating coefficients");
if (typeof(applet)!="undefined") {
if (typeof(applet.setValue)!="undefined") {
////////////////////////////////////////////////////////////////
// List the values of the parameters to be set in the applet here
// Set variables "a" and "b" in GeoGebra to values $a & $b from WebWork
// But this first example passes nothing from ww to ggb
applet.setValue("accin", $accin);
// applet.setValue("b", $b);
// applet.setCoords("C", $a, $b);
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT

##################################
# Setup GeogebraWebApplet --
###################################
# // deleted Affixed protective <div> s to prevent overlapping text
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function ggbOnInit(param) {
var applet = document.$appletName;
if (param == "$appletName") {
applet_loaded(param,1); // report that applet is ready.
ww_applet_list[param].safe_applet_initialize(2);
ww_applet_list[param].object = param;
console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );
}

}
</script>
END_SCRIPT
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setConfig() {
var appletState = getQE('${appletName}_state').value;
if (ww_applet_list['$appletName'].object == undefined ) {
setTimeout("setConfig()", 5000);
console.log("waiting");
} else {
var applet=$appletName;
}
}
</script>
END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var A = applet.getValue("accuracy"); // from GeoGebra, 'a' to Webwork?
var D = applet.getValue("acc"); // from GeoGebra, 'd' to Webwork?
var A = (applet.getValue("accuracy") == applet.getValue("acc"))? 1:0; // true/false
var D = (A == 1)? 2:3; // true/false
//var B = applet.getYcoord("C"); // from GeoGebra, 'b' to Webwork? or JS?
getQE('A').value = applet.getValue("accuracy"); // Send value to ww
getQE('D').value = applet.getValue("acc"); // Send value to ww
//getQE('B').value = applet.getYcoord("C"); // Send value to ww
return(A);
//return(B);
}
</script>
END_SCRIPT
###################################
#insert applet into body -- this does not need to be changed
# except to adjust the insertion of the reinitialize_button or
# a hidden AnswerBox
###################################
TEXT($PAR, MODES(TeX=>'geogebraweb code',
HTML=>$applet->insertAll(
debug =>0,
reinitialize_button => 1,
includeAnswerBox=>1,
)));

#######################################
# TEXT
#######################################
Context()->texStrings;
BEGIN_TEXT
$BR
Enter the value you see in the text.$BR
$BR
$BR
$BR
$BR
$BR
\(\quad \quad \quad \quad \quad \quad \quad \quad accuracy\) = \{NAMED_ANS_RULE("A", 5)\} Compared against \{$accin\} $PAR
$BR
\(\quad \quad \quad \quad \quad \quad \quad \quad 2nd entry\) = \{NAMED_ANS_RULE("D", 5)\} Compared against \{$accin\} $PAR
END_TEXT
#
#
#
#\(\quad \quad \quad \quad \quad \quad \quad \quad \quad \)number entry = \{NAMED_ANS_RULE("A", 10)\} $PAR
# CenterX = \{NAMED_ANS_RULE("Ax", 20)\} $PAR
#CenterY = \{NAMED_ANS_RULE("Ay", 20)\} $PAR
#Radius_squared = \{NAMED_ANS_RULE("radius_squared", 20)\} $PAR

#TEXT($PAR, "foostate |", $inputs_ref->{ "${appletName}_state"}, "|");

#TEXT( "run SetConfig", q!<script language="javascript">setConfig()</script> !) if $inputs_ref->{ "${appletName}_state"} =~ "restart_applet";

#TEXT( "run SetConfig", q!<script language="javascript">setConfig()</script> !) if $inputs_ref->{ "${appletName}_state"};


#########################################
# ANSWER section
#########################################
#\(\quad \quad \quad \quad \quad \quad \quad \quad \quad \)Coordinate \(x\) = \(\quad\)\{NAMED_ANS_RULE("A", 5)\} Should be \{$a\} $PAR

#NAMED_ANS( 'Ax' => Real($a1)->cmp );
#NAMED_ANS( 'Ay' => Real($b1)->cmp );
#NAMED_ANS( 'radius_squared' => Real($r2)->cmp );
# Compares student entry in ggb with WW passed variable
NAMED_ANS( 'A' => Real($accin)->cmp );
NAMED_ANS( 'D' => Real($acc)->cmp );
#NAMED_ANS( 'B' => Real($b)->cmp );
#Compares WW with WW
NAMED_ANS( 'answerBox' => Real($answer)->cmp );
#NAMED_ANS( 'answerBox' => $ansb->cmp );

#######################################
sub GEOGEBRA_PARAMS {
my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
ggbbase64=>"UEsDBBQACAgIAFeH1kwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICABXh9ZMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMm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AAZ2VvZ2VicmFfZGVmYXVsdHMzZC54bWxQSwECFAAUAAgICABXh9ZMhspkLDkQAACRdQAADAAAAAAAAAAAAAAAAAC5CAAAZ2VvZ2VicmEueG1sUEsFBgAAAAAEAAQACAEAACwZAAAAAA=="

};

$result;
}
ENDDOCUMENT();


In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -

A Partial success with a working model.

By comparing strings passed from an embedded GeoGebra applet to WeBWorK we were able to use a customized answer checker to solve our problem. To review: An embedded GeoGebra applet prompts students to click and drag 13 coordinate points for vertical placement for a connected line plot that approximates the sketch of the derivative overlaid a graph of the parent function. The string that is passed from GeoGebra is an accuracy score with an affixed percentage (for example 73%). The passed string has its percentage stripped within the custom answer checker which permits the remaining integer to be evaluated within a series of intervals that return comments and appropriate scores to the student.

We recognize that there is probably a more elegant way to create such a problem. But we could not get numeric values to pass from GeoGebra with any success and have settled on this stripped string custom answer checker.

Our Questions:

1.) Is there a way to pass numeric values from GeoGebra and assign them to a WeBWorK variable? We have not found any way to manage this.

2.) We would like to have greater control of the resulting score passed from GeoGebra to WeBWorK such that a score of 78% achieved in the applet is awarded 78% of the possible points in WeBWorK. Currently that 78% is rounded up to next multiple of 5 at 80% with our custom answer checker. Short of writing 100 individual answer checkers, is there a way to accomplish this?

3.) Sadly we could not work our way around the overlapping text issue that resulted from the latest version of GeoGebra. We try to use Mike Gage’s hot fix #354 but were not successful. How are the corrective lines below to be used? Is it not in the problem itself?
We are ww subscribers if this matters.

hot fix #354:
<div class = “enclose_geogebra_object”>
<div class = “geogebra_object”>
<script language=”javascript”>

</div>
</div>

Any feedback is most appreciated!

Tim


## This Homework problem uses an embedded GeoGebra applet

## that prompts the student to manipulate the vertical placement

## of 13 coordinate points in order to approximate the sketch of the

## derivative for a given graph of a function.

## The GeoGebra applet "scores" the student's attempt and this score

## must be passed back as a score to the WEBWorK answer checker.

## The GeoGebra applet was written by Professor Marc Renault and used here

## with permission. Check out his website for this and other GeoGebra applets

## related to first year Calculus courses:

## http://webspace.ship.edu/msrenault/GeoGebraCalculus/derivative_try_to_graph.html

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGinfo.pl",

"unionTables.pl",

"AppletObjects.pl",

"contextArbitraryString.pl",

"answerHints.pl",

"PGcourse.pl",

);

TEXT(beginproblem());


$showPartialCorrectAnswers = 1;

Context("Numeric");


#################################

# Only a "correct" answer variable is declared as a string

# for comparison for the upper threshold of

# " > 95%" for a variable declaration

#################################

Context("ArbitraryString");

$cor ="> 95%"; # Accuracy above 95% is awarded 100%

Context("Numeric");

######################################

# Create link to applet:

###################################

# You can name your applet (anything reasonable :-) )

# Adjust the height and width as desired

# Paste the geogebra parameters in at the bottom of the page just above the

# command end command

# so that they don't get in the way

###################################


$appletName = "numberTest";

$applet = GeogebraWebApplet(

code => "geogebra.GeoGebraApplet",

archive => "geogebra.jar",

codebase => findAppletCodebase("geogebra.jar"),

appletName => $appletName,

appletId => $appletName,

submitActionAlias => 'getAppletValues', # default actionAlias

initializeActionAlias => '', # default actionAlias

setStateAlias => 'setXML',

getStateAlias => 'getXML',

setConfigAlias => '',

getConfigAlias => '',

returnFieldName => '',

width => 700, # may want to modify width

height => 300, # may want to modify height

# mayscript => "true",

debugMode => 0, # set debugMode to 0 for no debug

# to 1 to make xml representation visible

# to 2 to add alerts detailing progression

# through the applet

onInit => 'ggbOnInit',

type => 'geogebraweb',

# "submitActionScript" takes the student submission in a geogebra applet

# and passes it to webwork: getQE() is a webwork call for geogebra submission?

# A general case of retrieving all values() vs the specific cases "a" and "b"

# is shown below. The specific cases are commented out.

submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },

#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },

#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },

selfLoading => 1,

params => GEOGEBRA_PARAMS(), # paste parameters in

);


#######################################################

# For setting initial values in GeoGebra from WeBWorK

# Uses JavaScript interface to GeoGebra.

# hotfix #354 via Mike Gage addressing the overlapping text

# with WeBWorK submission buttons was attempted and disgarded below.

# Affixed protective <div>s to prevent overlapping text, could not be fixed

#############################################################

TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function setAppletCoefficients() {

var applet=getApplet("$appletName"); // alert("Updating coefficients");

if (typeof(applet)!="undefined") {

if (typeof(applet.setValue)!="undefined") {

////////////////////////////////////////////////////////////////

/* List the values of the parameters to be set in the applet here:

One could assign the commented values of "a" and "b" in GeoGebra

to the WeBWorK variables $a & $b here. But this problem passes nothing

from ww to ggb as it relies upon the student's manipulation of the applet

and the resulting score to be passed back to WeBWorK. The commented examples

below are just kept as a reference for future problems...

*/

// applet.setValue("a", $a);

// applet.setValue("b", $b);

// applet.setCoords("C", $a, $b);

} else {

setTimeout("setAppletCoefficients()", 1000);

}

} else {

setTimeout("setAppletCoefficients()",1000);

}

}

ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};

</script>

END_SCRIPT


##################################

# Setup GeogebraWebApplet --

###################################


HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function ggbOnInit(param) {

var applet = document.$appletName;

if (param == "$appletName") {

applet_loaded(param,1); // report that applet is ready.

ww_applet_list[param].safe_applet_initialize(2);

ww_applet_list[param].object = param;

console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );

}

}

</script>

END_SCRIPT

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function setConfig() {

var appletState = getQE('${appletName}_state').value;

if (ww_applet_list['$appletName'].object == undefined ) {

setTimeout("setConfig()", 5000);

console.log("waiting");

} else {

var applet=$appletName;

}

}

</script>

END_SCRIPT


HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">

function getAppletValues() {

console.log("getAppletValues() entered");

// get a handle for the applet object

var applet = $appletName;

var D = applet.getValueString("text1"); // from ggb, accuracy to ww

/* The getQE ("Get Question Element") places the GeoGebra value in a

ww answer box as long as the supporting code is there to support the

box entry. But here we want the box to be invisible and for ggb to pass

the accuracy score to ww for comparison.

*/

// getQE('D').value = applet.getValueString("text1"); //Send value to ww

return(D); // Needed for ww to receive value D from ggb

}

</script>

END_SCRIPT

###################################

#insert applet into body -- this does not need to be changed

# except to adjust the insertion of the reinitialize_button or

# a hidden AnswerBox

###################################

TEXT($PAR, MODES(TeX=>'geogebraweb code',

HTML=>$applet->insertAll(

debug =>0,

reinitialize_button => 1,

includeAnswerBox=>1,

)));


#######################################

# TEXT

#######################################

#$ans7 =~ s/%/ppp/;

#$dum =~ s/ %//;

#$dum =~ s/> //;

#$ans6=~'answerBox';

Context()->texStrings;

BEGIN_TEXT

$BR

$BR

$BR

$BR

$BR

$BR Click and drag each purple coordinate point to make a sketch of the

$BR derivative based upon the slope of the parent function in black.

$BR Use the slider to determine the slope of the tangent line

$BR as an aid to approximate the sketch of the derivative.

$BR

END_TEXT


#########################################

# ANSWER section

## This answer checker takes ggb string 'D' as $s, "student input"

## and compares it to a ww string ($cor) after a strip ( a search and replace)

## of the non-numeric symbols of "%", ">", and " ". The stripped ww string "$cor"

## is assigned to "$c" for "correct", from ww.

## The PostFilter answer hint permits the stripped strings

## to be evaluated as Numeric intervals for Student feedback and scoring...

###############################################################

Context("ArbitraryString");

NAMED_ANS( 'answerBox' => String($cor)->cmp->withPostFilter(AnswerHints(

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"

$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"

$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer

return (($s >= 0) && ($s <= 50)); } => ["Oh no! You must score more than 50%, for any credit. Try again.", score => 0],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 50) && ($s <= 60)); } => ["You could do better with another attempt, yes?", score => 0.60],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 60) && ($s <= 70)); } => ["Try again. You can manage better than this.", score => 0.70],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 70) && ($s <= 75)); } => ["This is okay, But you could do better, yes?", score => 0.75],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 75) && ($s <= 80)); } => ["You are getting better, Try another?", score => 0.80],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 80) && ($s <= 85)); } => ["Nice Work!", score => 0.85],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 85) && ($s <= 90)); } => ["Very Good!", score => 0.90],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return (($s > 90) && ($s <= 95)); } => ["Excellent!", score => 0.95],

sub {

my( $c, $s, $self) =@_;

$c =~ s/> //;

$c =~ s/%//;

$s =~ s/%//;

return $s > $c; } => ["Perfect!", score => 1],

)));

#######################################

sub GEOGEBRA_PARAMS {

my $result = {

showResetIcon=>"false" ,

enableRightClick=>"false" ,

enableLabelDrags=>"false",

showMenuBar=>"false" ,

showToolBar=>"false",

showAlgebraInput=>"false",

useBrowserForJS=>"true",

ggbbase64=>"UEsDBBQACAgIALs+3EwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICAC7PtxMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7VrfU9s4EH6+/hUaP909kNiOnQSG0KGdubnOUHpzMJ17VeyNo0ORfJJMHP76yvLPkJgGB0qg5QFrFWklfftpvVr59H26oOgWhCScTSynZ1sIW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AAAA"

};


$result;

}

ENDDOCUMENT();


In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Greetings:

We have cleaner version of the embedded GeoGebra applet here.
While this version is an improvement we still are resigned to using strings as passed values from GeoGebra to WeBWork. This requires using a custom answer checker with which to check for the string to fall within an interval for a response and score for the student.

Is there a way in which we could pass numerical values from GeoGebra and assign these values to a variable in WeBWorK for an answer check comparison?

Thanks for any consideration.

Tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Danny Glin -
I don't know anything about the GeoGebra embedding, but if you are able to pass the string back to WeBWorK, you should be able to convert that to a number and use that in a custom answer checker.

I would expect it to work if you replaced "score => 0.60" with "score => $s/100" in each of your cases to get the exact score.

In fact, you should be able to use the following checker to simply set the student's grade to the accuracy:

NAMED_ANS( 'answerBox' => String($cor)->cmp( checker=>sub {
my( $c, $s, $self) =@_;
$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"
$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"
$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer
return $s/100;
}));

This still requires a custom answer checker since the student answer is passed to WeBWorK as a string, but it should get you around needing cases for each score.
In reply to Danny Glin

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Thank you Danny,

The individual replacement suggestion of "score => 0.60" with "score => $s/100" did not work within the PostFilter AnswerHints.

However your individual code block for the problem did work nicely, but only in our earlier versions.

NAMED_ANS( 'answerBox' => String($cor)->cmp( checker=>sub {
my( $c, $s, $self) =@_;
$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"
$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"
$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer
return $s/100;
}));

The later versions use a "Submit" button within the GeoGebra applet, but even if we take this out the "Check Answer" and "Correct Answer" box are non-responsive within WeBWorK.

Thanks for your help but I think we have a new glitch to solve.

Could it be the case of overlapping text that is the problem?
Hopefully some one can see the glitch that we can not...

Thanks, tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Michael Gage -
I've put these examples up at:


So you can see how it works. Login as guest. You can also view the source code.

The most important point is that problems 2 and 3 have the value "debug" set
to 1 (or 2). This makes the hidden answerBox visible, it also makes the
hidden input box that stores the state of the geogebra applet visible (and supposedly resets it so that the geogebra applet is persistent from one viewing to another). The latter feature doesn't seem to be working -- I haven't investigated it.

Having debug on allows you to more closely examine the output being created by the applet. By looking at the XML representing the state of the geogebra applet you can get a good idea of what objects it has and what the names of the objects are.

Apparently it's not easy to get just a value from geogebra without the label. Instead of 48 you always get acc = 48 where acc is the label of the value.


The promised fix for this getRHSValueString hasn't materialized.

There was another reference that suggested a solution -- but it hasn't worked for me:

I wasn't able to get Danny's solution to work either -- $s/100 complained about dividing a string by a number. I think it is a message from the "ArbitraryString" context.

What did work for me was to trim the string in javaScript:

var D = applet.getValueString("acc"); // from ggb, accuracy to ww
D = D.match(/\d+/);
return(D);

this returns only the number in "acc = 79"

and then for the answer checker I used

NAMED_ANS( 'answerBox' => String($cor)->cmp( checker=>sub {
my( $c, $s, $self) =@_;
$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"
$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"
#$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer
$s1 = Real("$s");
return $s1 > $c; # returns 1 or 0
})); I'm not sure whether the Real() operator is needed there. You can also add messages as you did in an earlier example. 
Problem 3 in the site also illustrates how you could obtain all of the coordinants of the spline from the geogebra applet -- and then do all
of the checking calculations in webwork. I'm not sure whether or not
that would be easier than doing the checking in the applet but it would
be easier to modify. That way you could have one all purpose applet
and use it for many different problems -- checking the spline differently in each case.

Still not sure why the geogebra app is not persistent from one viewing to the next -- are you generating randomness within the geogebra app without relying on the problem's seed? Do you want the app to behave that way?
In reply to Michael Gage

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Thank you Mike!

We will pour over your detailed instructions.
I am taking about a 10 day break from the office but will be back mid-July to work through this.

We really want the GeoGebra-WeBWorK interface to be a workable solution.

Thanks for giving us such detailed feedback!

Tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Andrew Parker -
Tim-

I've got some suggestions for this problem, but I'll try to relay them in such a way as to provide broader assistance for working with GeoGebra embedding in WeBWorK more generally:

1) Make sure you have access to an editable GeoGebra file - the objects in the GeoGebra construction are vital to being able to "pull" data from the applet in order to grade student work. (This is irrelevant if you create your own applets, but crucial if you're using someone else's... I searched Marc Renault on geogebra and found his construction for this applet - without that, I wouldn't have been able to "fix" this particular applet to work with WeBWorK)

2) Looking at Marc's construction, he has a different context for his applet - so re-randomization only happens when a student explicitly clicks on "reset". In WeBWorK, every time a student submits their work, the function will be re-randomized and the student will have to start from scratch. We'd like to generate values for the function and use those - to maintain persistence on the part of repeated attempts by the student.

Breaking down Marc's construction, he's fitting a curve to 9 randomly selected points with fixed x-values: {-12, -9, -6, ... 12} with integer-valued y-coordinates in [-2,3].

3) I've made a copy of the original construction and revised it for use with WeBWorK: ( https://ggbm.at/j36pqyuk ) I've replaced his randomization of the points with fixed points (R through Z) for which WeBWorK can assign values. (You can get the ggbbase64 from the linked page, I believe)

TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setAppletCoefficients() {
var applet=getApplet("$appletName"); // alert("Updating coefficients");
if (typeof(applet)!="undefined") {
if (typeof(applet.setValue)!="undefined") {
 
////////////////////////////////////////////////////////////////
// List the values of the parameters to be set in the applet here
 
// Replace the randomization on-load of the applet
applet.evalCommand("R = (-12, $y[0])");
applet.evalCommand("S = (-9, $y[1])");
applet.evalCommand("T = (-6, $y[2])");
applet.evalCommand("U = (-3, $y[3])");
applet.evalCommand("V = (0, $y[4])");
applet.evalCommand("W = (3, $y[5])");
applet.evalCommand("X = (6, $y[6])");
applet.evalCommand("Y = (9, $y[7])");
applet.evalCommand("Z = (12, $y[8])");
applet.evalCommand('SetVisibleInView[gRes,1,False]');
applet.evalCommand('SetVisibleInView[btnReveal,1,True]');
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT

`applet.evalCommand("...");` is going to be an important tool when working with GeoGebra applets in WeBWorK. By placing these commands in the `setAppletCoefficients()` subroutine, they get called whenever the applet is initially loaded. (This subroutine is _not_ called when a student submits their answer, but it _is_ called if a student uses the reinitialize_button)

In this case, I have set up a loop to generate the y-coordinates for these 9 points, and I'm assigning them to the points R through Z (which already exist in the geogebra construction, I'm just updating their values to match the WeBWorK randomization)

foreach my $i (0..8) {
$y[$i] = random(-2,3,1);
}

Finally, there are two evalCommand statements at the end which 'reset' the visibility of the "reveal" button, and hide the visibility of the graph of f'(x). This ensures that students must completely reset the applet before they can receive credit for the problem. (i.e. they cannot reveal the graph of f'(x), then drag the points to match, then hide the graph of f'(x) before submitting...)

I "borrowed" these two commands verbatim from the 'onClick' scripting of the "reset" button in the original GeoGebra construction.

4) The `getAppletValues()` subroutine is where you want to pull only the relevant information for assessing student work. If you do not know the names of the objects in the GeoGebra construction, you have no shot at being able to do this. In your early attempts, you were pulling some of the text strings from the construction - when what you really wanted to pull was the numeric variable "accuracy"

HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );

<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var accuracy = applet.getValue("accuracy");
var isVisible = applet.getVisible("btnReveal",1);
return( accuracy + "," + isVisible );
}
</script>
END_SCRIPT

Here, I am pulling the value of "accuracy", as well as the visibility of the "Reveal" button (boolean: true/false) - and then the return statement is a javascript string (using "+" instead of "." as in perl) to return a string containing my relevant information, separated by a comma.

In general, this is my preferred mode of retrieving values from a GeoGebra applet - assign javascript variables for everything I want, then return them as a comma separated list.

We now need a custom answer checker to split these relevant pieces of information and evaluate them:

$custom = sub {
my ($correct, $student, $self) = @_;
my ($acc,$eligible) = split(/,/,$student,2);
return ( $eligible eq 'true' && $acc > 95);
};

I have added both 'true' and 'false' to the problem Context() as strings, so that WeBWorK doesn't complain when receiving this input as the student answer. Notice that we're testing to make sure that the student hasn't revealed the graph of f'(x) when they submit their answer - this would be a rather easy problem otherwise...

The use of `split( /,/, <string>, max partitions );` turns our "return" string from the JavaScript into an array from which we can evaluate the pieces separately. As I mentioned above, this is my preferred method of passing information from GeoGebra to WeBWorK - the only change will be the maximum number of partitions (if I want to pass more parameters).

The "correct" answer being passed to the checker is a list containing a numeric value and a string:

$answer = List(Real(100),String('true'));

NAMED_ANS( 'answerBox'=>$answer->cmp(checkTypes=>0, checker=>$custom) );

Again, I added the strings 'true' and 'false' to the context.

Context("Numeric");
Context()->strings->add('true'=>{}, 'false'=>{});

I hope all this has been enlightening, and best of luck as you continue working with GeoGebra and WeBWorK!

-Andrew

PS: I recommend using https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_API as a reference for what you can do in both the `setAppletCoefficients()` and `getAppletValues()` subroutines.
In reply to Andrew Parker

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Andrew Parker -
I forgot to add that the custom answer checker could be made _much_ better.

For example:

$custom = sub {
my ($correct, $student, $self) = @_;
my ($acc,$eligible) = split(/,/,$student,2);
Value::Error("You need to reset the construction and try the problem without looking at the graph of \( f'(x) \).") if ($eligible eq 'false');

# set other messages for various ranges of accuracy

$partialCredit = ($acc > 95)? 1 : $acc/100; # full credit if > 95 accuracy
return ( $partialCredit );
};

In reply to Andrew Parker

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Andrew Parker -
I've also attached my working version of this problem, if that's any further help.
In reply to Andrew Parker

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Thank you Andrew for the remaking of the "randomized-derivative-graph".

We will be spending the week digesting this and your previous post on this problem.

We are getting some warning messages with the version you posted though:

PG warning messages

------
auxiliary file line-intercepts-multians.png missing resource path
------
The macro alias cannot find the file: |line-intercepts-multians.png| anywhere
------
The macro alias was unable to form a URL for the auxiliary file |line-intercepts-multians.png| used in this problem.


This does not seem to prevent the problem from working, but is there something we can/should do to address these warnings?

Thanks for the detailed feedback....Tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Andrew,

I understand that the warning message that I received is just for the lack of an image for this problem for where it is stored. But since each student would be receiving a randomized version of the parent function how would an image be created and then stored for the hard copy version of this problem?

This is only a secondary problem as we are still digesting your version of a persistent function for this problem. Thanks again for the work on this.

Tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Andrew Parker -
Tim-

Yes, that is a leftover reference to a static image from a prior WeBWorK/GeoGebra problem that I used as a foundation for helping you with your question.

I've now updated this code to dynamically generate an image for each randomization via the AskSage functionality of WeBWorK. (This was actually my first attempt at using AskSage in WeBWorK, so thank you for the inspiration cool)

The code is attached here, but essentially the additions include querying Sage (to do what GeoGebra is also doing - ugh, redundancy) but I don't know how to retrieve the fitted polynomial from GeoGebra before the problem has even been attempted. So instead, Sage and some Python are used to retrieve (and reasonably format) our polynomial. That polynomial is then added to an image (for hardcopy), and its derivative is added to a second image that is displayed in the solution.

Let me know if you have any questions about the code, I'd be happy to clarify wherever necessary.

-Andrew
In reply to Michael Gage

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
In Response to your last Question of the embedded GeoGebra applet.

Our intention for the applet was for the student to submit a score for an attempt by first clicking on "Submit" within the applet, and have the resulting score passed to WeBWorK. But the applet should "persist" with its current function by showing the student the accuracy score that was just submitted and the sketch of the derivative. The student could then experiment with the placement of points to see how this improve the accuracy within the applet, but any improved scores would not be passed on to WeBWorK unless the "Reset: button was hit to re-attempt a new problem.

It seems that this is not working as intended now, but it was last week?

I am not sure how we can rely upon the "problem seed" value and how this permits the applet to persist until the "Reset" button is hit.

Tim

In reply to Michael Gage

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by tim Payer -
Thank you Michael,

But we still have a problem running the code from the code source examples you posted. Specifically it is the overlapping text and "Check Answer" buttons that were created from the latest version of GeoGebra. The hot fix of #354 we were not sure of where to place to amend our code.
Given that we are subscribers, does limit us for applying this fix?
If not, how can we apply this fix for the GeoGebra overlap?

Thanks, Tim
In reply to tim Payer

Re: Passing GeoGebra values to WeBWorK as "correct" answers?

by Michael Gage -
The hotfix #354 was merged into the master branch on May 31. (It was also merged into the develop version). If you update your server installation
using git (this usually can be done with some variation of
"git pull" executed in webwork2/pg/lib directory -- check with your IT person about this.) After updating the server should be restarted.



The only file changed is pg/lib/Applet.pm and you can see the changed lines
(most of which are comments). You could make them yourself in your local copy of the file with an editor.

There are no limits -- all of this software is open source and free. (SAR :-) )