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

Peter Dencker dencker at math.uni-luebeck.de
Sat Jun 13 13:42:31 EDT 2015


Hello.

A remark regarding my confusion with the behavior of the function 
'submission'.

I observed the following on different domains with LON-CAPA version 
2.11.0: After submitting 3 answers, e.g. 'first', 'second', 'third', the 
problem given below (published, inside a course) shows

value of $version = 0, return value: third
value of $version = 1, return value:
value of $version = 2, return value: first
value of $version = 3, return value: second
value of $version = 4, return value: third
value of $version = 5, return value:

But the problem worked as expected on two tested domains with
LON-CAPA 2.11.1.


- Peter

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

     our $response;
     for my $version ( 0 .. 5 ) {

         my $submission
           = submission( 'p0', 'p0r0', $version );

         $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>



Am 06.06.2015 um 01:06 schrieb Peter Dencker:
>
> 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