[LON-CAPA-cvs] cvs: loncom /homework response.pm /html/adm/help/tex Problem_LON-CAPA_Functions.tex all_functions_table.tex

raeburn raeburn at source.lon-capa.org
Wed Jun 6 14:40:08 EDT 2018

raeburn		Wed Jun  6 18:40:08 2018 EDT

Modified files:
/loncom/homework	response.pm
all_functions_table.tex
Log:
- Support retrypartial parameter in &check_status().

Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.245 loncom/homework/response.pm:1.246
--- loncom/homework/response.pm:1.245	Fri Mar 30 23:50:13 2018
+++ loncom/homework/response.pm	Wed Jun  6 18:39:55 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.245 2018/03/30 23:50:13 raeburn Exp$
+# $Id: response.pm,v 1.246 2018/06/06 18:39:55 raeburn Exp$
#
# Copyright Michigan State University Board of Trustees
#
@@ -1348,10 +1348,12 @@
and all true values mean that they can't do any more work

a return of undef means it is unattempted
-	a return of 0 means it is attmpted and wrong but still has tries
+	a return of 0 means it is both attempted and still has tries and
+                      is wrong or is only partially correct, and retries
+                      are allowed.
a return of 1 means it is marked correct
-	a return of 2 means they have exceed maximum number of tries
-	a return of 3 means it after the answer date
+	a return of 2 means they have exceeded maximum number of tries
+	a return of 3 means it is after the answer date

=cut

@@ -1368,7 +1370,13 @@
return 3;
}
my $status=&Apache::lonnet::EXT("user.resource.resource.$id.solved");
-    if ($status =~ /^correct/) { return 1; } + if ($status =~ /^correct/) {
+        my $awarded=&Apache::lonnet::EXT("user.resource.resource.$id.awarded");
+        my $retrypartial=&Apache::lonnet::EXT("resource.$id.retrypartial");
+        unless (($retrypartial =~ /^1|on|yes$/) && ($awarded <1)) { + return 1; + } + } if (!$status) { return undef; }
my $maxtries=&Apache::lonnet::EXT("resource.$id.maxtries");
if ($maxtries eq '') {$maxtries=2; }
--- loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.33	Sun Sep 24 01:52:57 2017
+++ loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex	Wed Jun  6 18:40:08 2018
@@ -136,7 +136,7 @@

\&name(), \&student\_number(), \&firstname(), \&middlename(), \&lastname()  & Return the full name in the following format: lastname, firstname initial. Student\_number returns the student 9-alphanumeric string. The functions firstname, middlename, and lastname return just that part of the name. If undefined, the functions return null. \\
\hline
-\&check\_status(\$partid) &Returns a number identifying the current status of a part. True values mean that a part is done'' (either unanswerable because of tries exhaustion, or correct) or a false value if a part can still be attempted. If \$part is unspecified, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attempted and wrong but still has tries, 1 means it is marked correct, 2 means they have exceeded maximum number of tries, 3 means it is after the answer date.\\
+\&check\_status(\$partid) &Returns a number identifying the current status of a part. True values mean that a part is done'': either unanswerable because of tries exhaustion, or fully correct, or only partially correct (and retries not permitted). A false value means that a part can still be attempted. If \$part is unspecified, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attempted but still has tries, and is either wrong (or partially correct, retries allowed), 1 means it is fully correct or partially correct (no retries), 2 means they have exceeded maximum number of tries, 3 means it is after the answer date.\\
\hline
\&open\_date(\$partid), \&due\_date(\$partid), \&answer\_date(\$partid) & Problem open date, due date and answer date in local human-readable format. Part 0 is chosen if \$partid is omitted.\\
\hline
--- loncom/html/adm/help/tex/all_functions_table.tex:1.16	Thu Jun 26 19:04:25 2014
+++ loncom/html/adm/help/tex/all_functions_table.tex	Wed Jun  6 18:40:08 2018
@@ -100,7 +100,7 @@
\hline
name(), student\_number() &\&name(), \&student\_number() &Return the full name in the following format: lastname, firstname initial. Student\_number returns the student 9-alphanumeric string. If undefined, the functions return null. &  \\
\hline
-NOT IMPLEMENTED IN CAPA &\&check\_status(\$partid) &Returns a number identifying the current status of a part. True values mean that a part is done'' (either unanswerable because of tries exhaustion, or correct) or a false value if a part can still be attempted. If \$part is unspecified, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attempted and wrong but still has tries, 1 means it is marked correct, 2 means the user has exceeded the maximum number of tries, and 3 means it is after the answer date &  \\
+NOT IMPLEMENTED IN CAPA &\&check\_status(\$partid) &Returns a number identifying the current status of a part. True values mean that a part is done'': either unanswerable because of tries exhaustion, or fully correct, or only partially correct (and retries not permitted). A false value means that a part can still be attempted. If \$part is unspecified, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attempted but still has tries, and is either wrong (or partially correct, retries allowed), 1 means it is fully correct or partially correct (no retries), 2 means the user has exceeded the maximum number of tries, and 3 means it is after the answer date &  \\
\hline
open\_date(), due\_date(), answer\_date() &\&open\_date(\$partid), \&due\_date(\$partid), \&answer\_date(\\$partid) &Problem open date, due date and answer date. The time is also included in 24-hr format. &Output format for time is changed slightly. If pass noon, it displays ..pm else it displays ..am. So 23:59 is displayed as 11:59 pm. \\
\hline