Hi Gerd,<br>I just remembered an example you sent us. The problem seems to work with the following code. Sorry for bothering you.<br><br>Best<br>Sebastian<br><br><i><problem><br><script type="loncapa/perl"><br>
sub rand_element { return $_[ random(0,$#_,1) ] }<br>$number = rand_element(0,1,2,3);<br>$answer_p2 = $number+2;<br>$submission_p1 = int(&submission(0,'r11'));<br></script><br><br> What is 1 + 1?<br> <br>
<block condition="&submission(0,'r11')!=2"> <br><customresponse id="r11"><br> <answer type="loncapa/perl"><br> if($number && &submission(0,'r11')==2){return 'MISSING_ANSWER';}<br>
if(&submission(0,'r11')!=2){return 'INCORRECT';}<br> return 'EXACT_ANS';<br> </answer><br> <textline /><br> </customresponse><br></block><br><br><block condition="$number>0 && &submission(0,'r11')==2"><br>
What is 2+$number?<br> <customresponse id="r12"><br> <answer type="loncapa/perl"><br> if(&submission(0,'r12')!=$answer_p2){return 'INCORRECT';}<br>
return 'EXACT_ANS';<br> </answer><br> <textline /><br> </customresponse><br></block><br></problem></i><br><br><div class="gmail_quote">2012/10/30 Gerd Kortemeyer <span dir="ltr"><<a href="mailto:korte@lite.msu.edu" target="_blank">korte@lite.msu.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div class="im"><br>
<br>
On Oct 30, 2012, at 11:55 AM, Sebastian Penka <<a href="mailto:penka@math.uni-luebeck.de">penka@math.uni-luebeck.de</a>> wrote:<br>
<br>
><br>
> is it possible, that students see the following problem as solved, if $number equals 0? In our course, students can see a second part in the "course contents" section, but they, of course, can't answer it, so that the problem is not marked as solved.<br>
<br>
</div>Nope. It's not solved, so it would not show up as solved. What's the background of this, i.e., what is scenario for which you are implementing this? Maybe there is a better way.<br>
<br>
- Gerd.<br>
<br>
_______________________________________________<br>
LON-CAPA-users mailing list<br>
<a href="mailto:LON-CAPA-users@mail.lon-capa.org">LON-CAPA-users@mail.lon-capa.org</a><br>
<a href="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users" target="_blank">http://mail.lon-capa.org/mailman/listinfo/lon-capa-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sebastian Penka, M.Sc.<br> wissenschaftl. Mitarbeiter<br><br>UNIVERSITÄT ZU LÜBECK<br> INSTITUT FÜR MATHEMATIK<br><br> Ratzeburger Allee 160<br> 23562 Lübeck<br>
<br> Tel +49 451 500 4662<br> Fax +49 451 500 3373<br> <a href="mailto:penka@math.uni-luebeck.de" target="_blank">penka@math.uni-luebeck.de</a><br><br> <a href="http://www.math.uni-luebeck.de" target="_blank">www.math.uni-luebeck.de</a><br>