[LON-CAPA-users] uploading test scores

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Mon, 29 Sep 2003 21:35:06 -0400 (EDT)

Hi Nathan,

> I got it to work.  Everything seems to be good functionally, but I have a
> design question...what if an instructor has a test with 75 points possible,
> and some student has 71 points correct.  If you figure the percentage you'll
> have repeating decimals, which will lead to a non-integer test score.
> Is there any way to force LON-CAPA to round to the nearest integer when
> displaying the test score?

The 'Upload' resource is in fact a very simple homework problem:
<displaytitle />
<script type="loncapa/perl">
if ((!defined($weight)) || ($weight eq '')) { $weight=1; }
if (!defined($awarded)) { $awarded=0; }
<startouttext />
You have <display>$awarded*$weight</display> out of $weight possible points.
<endouttext />
<notsolved><numericalresponse id='score' /></notsolved>

If you want it to round, make a new resource with the above contents
but change:

You have <display>$awarded*$weight</display> out of $weight possible points.


You have <display>&roundto($awarded*$weight,0)</display> out of $weight possible points.

Publish this and use it as the upload problem.

guy@albertelli.com  LON-CAPA Developer  0-7-5-6-