<div dir="ltr">Stuart,<div><br></div><div>Thanks for the help.  I'll start experimenting with the &submission in 2.11 on the testdrive server since we aren't going to be able to update our servers to 2.11 until our break in May.</div><div><br></div><div><br></div><div>Bob Gonzales</div><div>Chemistry Dept</div><div>Binghamton University<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 11, 2014 at 3:39 PM, Stuart Raeburn <span dir="ltr"><<a href="mailto:raeburn@msu.edu" target="_blank">raeburn@msu.edu</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Any help or comments regarding any submission handling would be appreciated.<br>
</blockquote>
<br>
The CAPA engine which determines correctness of submissions for numericalresponse items (amongst others) tries its best to extract a number from data submitted by the student. However, LON-CAPA faithfully records the learner's actual submission.<br>
<br>
Accordingly, it is possible, as you have found, for a student to provide some misshapen input in an initial part in a multi-part problem, which LON-CAPA grades as correct, but then when you come to use that submission in a perl script block for a subsequent part, it does not behave as you might expect.<br>
<br>
See comment #3 in bug 6614 -- <a href="http://bugs.loncapa.org/show_bug.cgi?id=6614#c3" target="_blank">http://bugs.loncapa.org/show_<u></u>bug.cgi?id=6614#c3</a><br>
<br>
There are three related enhancement requests: 6609, 6613 and 6614 (all resolved in 2.11.0), with option (b) below.<br>
<br>
Your options are:<br>
<br>
(a) Include a preprocessor routine. (There is a problem template: "Numerical Response with Pre-Processing" which is an example of this functionality). The "preprocess" attribute was first included in LON-CAPA 2.10.1<br>
<br>
or<br>
<br>
(b) Retrieve the student's previously submitted data using &submission() in place of &EXT(), and specify desired clean-up in the optional fifth argument in the call to &submission(). This fifth argument is a reference to a hash, with one or more of the following keys => values:<br>
<br>
  exponent => 1, comma => 1, letterforzero => 1, spaces => 1, format => 'ns'<br>
  (where n is an integer, i.e., number of significant digits).<br>
<br>
An example call, where part id of first part is "one", and response ID of<br>
numericalresponse in that part is "11" would be:<br>
<br>
$first = &submission('one','11','','',{<u></u>exponent => 1, comma => 1, letterforzero<br>
=> 1, spaces => 1, format => '3s'});<br>
<br>
with spaces => 1 included:<br>
<br>
0. 44 in learner data would be converted to 0.44<br>
<br>
This fifth argument in &submission() was first included in LON-CAPA 2.11.0.<br>
<br>
If you want to try this out, but your library server is running 2.10.1, visit: <a href="https://testdrive.loncapa.org/" target="_blank">https://testdrive.loncapa.org/</a> and create a username and authoring space in the testdrive domain (not connected to the main LON-CAPA network) - running 2.11.0.<br>
<br>
or<br>
<br>
(c) Create your own clean-up routines (e.g., in a .library file) and import the file into your problems, and then within the script block call the routine you created to clean up the learner data.<br>
<br>
or some combination of two or more of (a), (b), and (c).<br>
<br>
Some time I ago I created a library file containing a routine: &cleaneq() which could be used to clean up algebraic expressions.  This file is published source XML open, so select an author role, and then browse the /res/msu/raeburn/ directory in the shared repository with the "Source Available" checkbox checked, and you will be able to click on "Source Code" to pop-open a window displaying the perl regular expressions used in the cleaneq routine in the cleaneq.library file.<br>
<br>
<br>
Stuart Raeburn<br>
LON-CAPA Academic Consortium<br>
<br>
<br>
Quoting Bob Gonzales <<a href="mailto:rgonzal@binghamton.edu" target="_blank">rgonzal@binghamton.edu</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I'd like to look at the code that Loncapa uses to clean up submissions in<br>
numerical response problems.  I'm referring to clean-up actions like<br>
converting exponents from '1x10^1' to '1e1' and removing leading '+' signs.<br>
<br>
We have some lab exercises in which we use the student's entered data  in<br>
some numerical response problems.  I'm getting the previously submitted<br>
data  via the &EXT() function.<br>
<br>
Every once in a while a student will submit their data with something  like<br>
a leading '+' sign, which Loncapa cleans up, and the data is accepted as<br>
correct.  So, it would be good for me to do the same clean up before I use<br>
the submission.<br>
<br>
I've looked around in the system and I see some cleanup in the<br>
'implicit_multiplication' routine in '<a href="http://caparesponse.pm" target="_blank">caparesponse.pm</a>'  but I'm not sure<br>
I'm even in the right place.<br>
<br>
Any help or comments regarding any submission handling would be appreciated.<br>
<br>
Thanks,<br>
Bob Gonzales<br>
Chemistry Dept<br>
Binghamton University<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
LON-CAPA-users mailing list<br>
<a href="mailto:LON-CAPA-users@mail.lon-capa.org" target="_blank">LON-CAPA-users@mail.lon-capa.<u></u>org</a><br>
<a href="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users" target="_blank">http://mail.lon-capa.org/<u></u>mailman/listinfo/lon-capa-<u></u>users</a><br>
</blockquote></div></div></div></div>