[LON-CAPA-users] function 'submission' and version

Peter Dencker dencker at math.uni-luebeck.de
Fri Jun 5 19:06:12 EDT 2015


Hello Gerd,

I see, thank you. If  $version=0 the latest submission is the specified 
return value.

But the return value for $version=1 is always undefined. The first value 
is given for $version=2, the seconed for $version=3, and so on.

This was the cause of my confusion and I wonder whether this is 
intended. I am almost certain that  this behavior differs from previous 
LON-CAPA versions ...

- Peter

<problem>
<script type="loncapa/perl">

   our $response = q{};
   for my $version ( 0 .. 6 ) {
       my $submission = submission ( 'p0', 'p0r0', $version );
       if (!defined $submission) { $submission = q{}; }
       $response
         .= "value of \$version = $version,"
         . " return value: $submission <br />";
   }

</script>

$response

<part id="p0">
<customresponse id="p0r0">
   <answer type="loncapa/perl">
     return 'INCORRECT';
   </answer>
   <textline />
</customresponse>
</part>
</problem


On 05.06.2015 13:02, Gerd Kortemeyer wrote:
> Hi,
>
>> On Jun 5, 2015, at 5:31 AM, Peter Dencker <dencker at math.uni-luebeck.de> wrote:
>>
>>
>> I tried to demonstrate that it is possible to show all submissions:
>>
>> submission( $partid, $responseid, $version )
>>
>> If  $version is 0, the latest submission is returned and for all other values of $version the return value is undefined.
>>
>> Have  I made a mistake or this a bug?
>
> Nope, this is how it *should* work.
>
> However, if I remember correctly, this only works when the problem is already inside a course, i.e., published and part of the table of contents of a course. Did you try this inside a course, or has your testing thus far only been in construction space?
>
> - Gerd.
>
> --
> Gerd Kortemeyer, Ph.D.
> Associate Professor of Physics
> Director, LON-CAPA Project
> Michigan State University
> http://www.msu.edu/user/kortemey/
>
>
>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>


-- 
Dr. Peter Dencker
     wissenschaftl. Mitarbeiter

UNIVERSITÄT ZU LÜBECK
     INSTITUT FÜR MATHEMATIK

     Ratzeburger Allee 160
     23562 Lübeck

     Tel +49 451 500 4254
     Fax +49 451 500 3373
     dencker at math.uni-luebeck.de

     www.math.uni-luebeck.de


More information about the LON-CAPA-users mailing list