Hi Gene,

It looks like


stored_data('tries', ID)


should get you what you want.


Best,

Jacob

________________________________
From: LON-CAPA-users <lon-capa-users-boun...@mail.lon-capa.org> on behalf of 
Harding, Gene L <glhar...@purdue.edu>
Sent: Friday, May 18, 2018 10:27:33 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Custom Response Partial Credit


Hi Jacob,



Thank you. I have managed to get it to respond correctly (red incorrect of 
total_score==0, tan partial credit if 0<total_score<1, and green correct if 
total_score==1). I have run quite a few tests and it seems to work fine with 
only this statement:

        return ('ASSIGNED_SCORE',$total_score);



I am still having one problem. There is a conditional block that shows a 
gnuplot of the correct answer if it is wrong and maxtries has been met. Before 
I converted to the customresponse the block worked fine, but now the 
&check_status function returns 1 no matter what, whether wrong, correct, or 
partially correct. Does that function not work with customresponse? If not, is 
there a LON-CAPA parameter for number of tries used? If so, I could compare 
that parameter to maxtries and do the same thing.



Best regards,



Gene L. Harding, PE

Associate Professor of ECET

574-520-4190



From: LON-CAPA-users <lon-capa-users-boun...@mail.lon-capa.org> On Behalf Of 
Jacob Bond
Sent: Friday, May 18, 2018 7:45 PM
To: Discussion list for LON-CAPA users <lon-capa-users@mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] Custom Response Partial Credit



Hi Gene,



You're right that the last return statement shouldn't be there.  Also, there is 
a subtlety about returning 'INCORRECT' in a partial credit problem.  If a 
student submits an answer that gets 1/2 credit, then changes it to an answer 
that gets 0 credit, returning 'INCORRECT' will leave the student with 1/2 
credit.  Perhaps this is what you want, but if not,



if ($total_score == 1) {return 'EXACT_ANS';}

else {return ('ASSIGNED_SCORE', $total_score);}



will suffice (if you know $total_score is between 0 and 1, inclusive).  (Also, 
it's possible that you can forget about the if statement entirely, in case 
LON-CAPA knows that ('ASSIGNED_SCORE', 1) is the same as 'EXACT_ANS', but I've 
never bothered testing this.)



As for the real issue, it's tough to say what might be going wrong without 
seeing the rest of the code, but you might try computing $total_score locally 
in the answer block and see if that fixes anything.  If you want to check what 
credit the student has received, this will set $partial_credit to what credit 
the student has received, or 0 if the student hasn't attempted the problem yet 
(ID should be replaced by the part ID of the problem part):



$partial_credit = &stored_data('awarded', ID) ? &stored_data('awarded', ID) : 
0.0;



Best,

Jacob

________________________________

From: LON-CAPA-users 
<lon-capa-users-boun...@mail.lon-capa.org<mailto:lon-capa-users-boun...@mail.lon-capa.org>>
 on behalf of Harding, Gene L <glhar...@purdue.edu<mailto:glhar...@purdue.edu>>
Sent: Friday, May 18, 2018 5:54:22 PM
To: Discussion list for LON-CAPA users
Subject: [LON-CAPA-users] Custom Response Partial Credit



Hi,



I rewrote the problem I have been working on so that it is now a custom 
response, but am having trouble getting it to properly grade the problem 
submission. This is the code for grading inside the answer block:

         if ($total_score == 1) { return 'EXACT_ANS'; }

           elsif ($total_score > 0) { return ('ASSIGNED_SCORE',$total_score); }

           else  { return 'INCORRECT'; }

         return ('ASSIGNED_SCORE',$total_score);



I have tried it with and without the second return statement, but either way 
the Correct/Partially Correct/Incorrect grading seems almost random. 
$total_score is computed in a perl script higher up in the program, and I am 
outputting it to verify that it is being computed correctly. I also have a 
retrypartial parameter at the top of the program because I want the students to 
be able to take three tries at it on the practice version:

<parameter name="retrypartial" type="string_yesno" description="Partially 
correct is answerable" default="yes" />



Can anyone see what I am doing wrong?



Thanks for any help/advice you can provide.



Best regards,



Gene L. Harding, PE

Associate Professor of ECET

574-520-4190


_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Reply via email to