Annotation of loncom/html/adm/help/tex/Custom_Response_Problems.tex, revision 1.5

1.1       www         1: \label{Custom_Response_Problems}
                      2: Custom Response is a way to have a problem graded based on an algorithm. The use of this response type is
                      3: generally discouraged, since the responses will not be analyzable by the LON-CAPA statistics tools.
                      4: 
1.5     ! www         5: For a single textfield, the student's answer will be in a variable \$submission. If the Custom Response has multiple textfields, the answers will be in an array
        !             6: reference, and can be accessed as \$\$submission[0], \$\$submission[1], etc.
        !             7: 
        !             8: The student answer needs to be evaluated by Perl code inside the <answer>-tag. Custom Response needs to return a standard LON-CAPA. The most common response are:
1.1       www         9: \begin{itemize}
                     10: \item EXACT\_ANS: return if solved exactly correctly
                     11: \item APPROX\_ANS: return if solved approximately
1.2       albertel   12: \item INCORRECT: return if not correct, uses up a try
1.5     ! www        13: \item ASSIGNED\_SCORE: partial credit (also return the credit factor, e.g. return(ASSIGNED\_SCORE,0.3);)
1.3       albertel   14: \item SIG\_FAIL, NO\_UNIT, EXTRA\_ANSWER, MISSING\_ANSWER, BAD\_FORMULA, 
1.2       albertel   15: WANTED\_NUMERIC: return if not correct for different reasons, does not use up a try
1.1       www        16: \end{itemize}
                     17: The answer display is shown instead of the student response in 'show answer' mode.
                     18: The following example illustrates this:
                     19: \begin{verbatim}
                     20: <problem>
                     21: <startouttext />Accept an answer of around 90 or -90<endouttext />
                     22:   <customresponse answerdisplay="something near 90 or -90">
                     23:     <answer type="loncapa/perl">
                     24: # We do not want a vector
1.3       albertel   25: if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
1.1       www        26: # Need a numerical answer here
                     27: if ($submission!~/^[\d\.\-\e]+$/i) { return 'WANTED_NUMERIC'; }
                     28: $difference=abs(90-abs($submission));
                     29: if ($difference==0) { return 'EXACT_ANS'; }
                     30: if ($difference < 0.1) { return 'APPROX_ANS'; }
                     31: return 'INCORRECT';</answer>
                     32:     <textline readonly="no" />
                     33:   </customresponse>
                     34: </problem>
                     35: \end{verbatim}
1.3       albertel   36: 
                     37: 
                     38: Full list of possible return codes:
                     39: \begin{itemize}
1.4       albertel   40: \item EXACT\_ANS: student is exactly correct
                     41: \item APPROX\_ANS:  student is approximately correct
                     42: \item NO\_RESPONSE: student submitted no response
                     43: \item MISSING\_ANSWER: student submitted some but not all parts of a response
                     44: \item EXTRA\_ANSWER: student submitted a vector of values when a scalar was expected
                     45: \item WANTED\_NUMERIC: expected a numeric answer and didn't get one
                     46: \item SIG\_FAIL: incorrect number of Significant Figures
                     47: \item UNIT\_FAIL: incorrect unit
1.5     ! www        48: \item UNIT\_NOTNEEDED: submitted a unit when one shouldn't
1.4       albertel   49: \item UNIT\_INVALID\_INSTRUCTOR: the unit provided by the author of the problem is unparsable
                     50: \item UNIT\_INVALID\_STUDENT: the unit provided by the student is unparasable
                     51: \item UNIT\_IRRECONCIBLE: the unit from the student and the instructor are of different types
                     52: \item NO\_UNIT: needed a unit but none was submitted
                     53: \item BAD\_FORMULA: syntax error in submitted formula
1.3       albertel   54: \item INCORRECT: answer was wrong
                     55: \item SUBMITTED: submission wasn't graded
                     56: \item DRAFT: submission only stored
1.4       albertel   57: \item MISORDERED\_RANK: student submitted a poorly order rank response
1.3       albertel   58: \item ERROR: unable to get a grade
1.5     ! www        59: \item ASSIGNED\_SCORE: partial credit; the customresponse needs to return the award followed by the partial credit factor  
        !            60: \item TOO\_LONG: answer submission was deemed too long
1.4       albertel   61: \item INVALID\_FILETYPE: student tried to upload a file that was of an extension that was not specifically allowed 
                     62: \item COMMA\_FAIL: answer requires the use of comma grouping and it wasn't provided or was incorrect
1.5     ! www        63: \end{itemize}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>