WeBWorK Main Forum

Issues with draggableProof.pl on WW3

Issues with draggableProof.pl on WW3

by Lijuan Cao -
Number of replies: 6

Our university recently upgraded to WW3 and it works nicely. Earlier this week, we experienced some issues with a draggable proof problem. If a student submits the same answer twice in a roll, the second answer is recorded as 'empty'. Because of which, the right column disappears. This was not an issue with WW2 and we are not sure how to fix it. Any suggestions? Thank you.

Below is the problem pg file:

DOCUMENT();        

loadMacros(

  "PGstandard.pl",

  "MathObjects.pl",

  "PGML.pl",

  "PGbasicmacros.pl",

  "parserRadioButtons.pl",

  "draggableProof.pl",

  "PGcourse.pl"

);

TEXT(beginproblem());

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

#  Setup

Context("Numeric");

$CorrectProof = DraggableProof([   

"Let \(n\) be even.",

"By the definition of even, \(n = 2k\) for some integer \(k\).",

"It follows that  

\(\\n^2 + 3n + 5 = (2k)^2 + 3(2k) + 5\)

\(\\ \hspace{38mm}= 4k^2 + 6k + 5\)

\(\\ \hspace{37mm} = 2(2k^2 + 3k+ 2) + 1\)",

"Since \(k\) is an integer,",

"\(2k^2 + 3k+ 2\) is an integer.",

"Since \(n^2 + 3n + 5\) equals \(2\) times an integer plus one,",

"\(n^2 + 3n + 5\) is odd."],

["\(2k^2 + 3k+ 2\) is even.",

"By the definition of odd, \(n = 2k + 1\) for some integer \(k\).",

"Let \(n\) be odd."] ,

SourceLabel => "Choose from this list of sentences",

TargetLabel => "Direct proof of the statement (in order):",

);

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

# Main text

BEGIN_PGML

Order *[$CorrectProof->numNeeded] of* the following sentences so that they form a direct proof of the statement: If [`n`] is even, then [`n^2 + 3n + 5`] is odd.

[@ $CorrectProof->Print @]*

END_PGML

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

#  Answer evaluation

$showPartialCorrectAnswers = 0;

install_problem_grader(~~&std_problem_grader);

ANS($CorrectProof->cmp);

ENDDOCUMENT();


In reply to Lijuan Cao

Re: Issues with draggableProof.pl on WW3

by Glenn Rice -
WW3 has not been released, and is in no shape to even do what you are claiming.  So I assume you mean that you upgraded to a recent version of WW2.  The latest release is version 2.17.  Is that what you have upgraded to?  Please give the correct version of webwork2 that you did upgrade to.

I tested your problem (recreated from what you gave), and I can not reproduce this issue.  Could you attach the actual problem?  The way you posted the problem in the text didn't work out so well.
In reply to Glenn Rice

Re: Issues with draggableProof.pl on WW3

by Lijuan Cao -
My bad. Our university uses webwork3 as the prefix so I thought it was version 3. You are correct, we currently use 2.17. I am attaching the problem below. Thank you.

Below are some screenshots to show what happened. 

At the beginning, there were 10 blocks in the left column, I moved 7 to the right, and click submit. Everything worked as expected.
first attempt

Then, without a change, I clicked submit again. The Answer Preview does not show anything and the right column disappeared. The past answers showed that the answer submitted for the attempt was 'empty'. 
webworkIssue

I checked the draggableProof macro and noticed that the content of the right column is created using the answer submitted on each attempt. This explained why the right column disappeared if the answer was 'empty'. But I am not sure what causes the answer of the second attempt to be 'empty'.
In reply to Lijuan Cao

Re: Issues with draggableProof.pl on WW3

by Glenn Rice -

Looking at your screenshots, those don't look right for WeBWorK 2.17.  I think you need to run "npm install" from the /opt/WeBWorK/pg/htdocs directory.

In reply to Glenn Rice

Re: Issues with draggableProof.pl on WW3

by Glenn Rice -

There was a typo in my last comment.  That should have been "npm install".  If you have the javascript and css up to date, this is what the draggable proof problems should look like. Notice that the coloring is quite different than what you show in your screen shots.

Attachment Screenshot from 2023-02-19 05-41-18.png
In reply to Glenn Rice

Re: Issues with draggableProof.pl on WW3

by Glenn Rice -
Actually, thinking about this more, I think that you are not using the draggableProof.pl macro in pg. I suspect that you have a copy of the old version of that macro in your courses templates/macros directory or somewhere else that is being loaded instead of the one in pg. The javascript for the macro in pg is loaded from a CDN, and so it wouldn't matter if you run "npm install" for the javascript. Although that will matter will for the css style since that is local. So check your courses macros directory first. If you have a draggableProof.pl file in there, then delete it (back it up if you want to keep it).
In reply to Glenn Rice

Re: Issues with draggableProof.pl on WW3

by Lijuan Cao -

You are correct. We had a copy of draggableProof.pl in the macros folders. After I deleted the file, the issue went away and the style/formatting looked the same as those in your screenshot.  Thank you very much for your help!