Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv3273
Modified Files:
Decimal.mpl TextQuestion.mpl
Log Message:
changed validation to allow a subtype of type string to be specified at the c> flag (without AiM trying to parse the student's answer)
Index: Decimal.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Decimal.mpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Decimal.mpl 1 Sep 2003 05:55:59 -0000 1.1
--- Decimal.mpl 20 Sep 2003 16:30:44 -0000 1.2
***************
*** 29,42 ****
`Package/Assign`(
! `type/RepeatingDecimal`::boolean,
! "Returns @true@ if the argument is a string and @`Decimal/isRepeating`(a)@ evaluates to @true@",
proc(a::anything)
! if type(a,string) and `Decimal/isRepeating`(a) then
! true
! else
! false
! fi
end
):
`Package/Assign`(
--- 29,44 ----
`Package/Assign`(
! `type/_RepeatingDecimal`::boolean,
! "",
proc(a::anything)
! return evalb(type(a,string) and `Decimal/isRepeating`(a))
end
):
+
+ `Package/Assign`(
+ `type/RepeatingDecimal`::type,
+ "Returns @true@ if the argument is a string and @`Decimal/isRepeating`(a)@ evaluates to @true@",
+ And(string,_RepeatingDecimal)
+ ):
`Package/Assign`(
Index: TextQuestion.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TextQuestion.mpl 27 Aug 2003 22:34:38 -0000 1.4
--- TextQuestion.mpl 20 Sep 2003 16:30:44 -0000 1.5
***************
*** 356,360 ****
rawans := attempt['RawAnswer'];
! if reqtype = string then
# don't allow the empty string to be valid or it will cause
# a penalty to be given if the student answers it correctly
--- 356,363 ----
rawans := attempt['RawAnswer'];
! # KM
! # WAS: if reqtype = string then
! if subtype(reqtype,string) then
! # END
# don't allow the empty string to be valid or it will cause
# a penalty to be given if the student answers it correctly
***************
*** 362,365 ****
--- 365,388 ----
# request for the quiz to be marked
if rawans = "" then attempt['IsValid']:=false; RETURN(false) fi;
+ # KM
+ # check that the string matches the required type in the case
+ # where the user has specified a subtype of type string
+ if (not(type(rawans,reqtype))) then
+ attempt['ValidationNote'] := __("wrong type");
+ attempt['ValidationMessage'] :=
+ cat(
+ "<font color='red'>",
+ `aim/HelpLink`(__("Wrong type"),"types"),
+ "</font>\n<br/>\n",
+ __("Your answer should have type"),
+ "\n<br/>\n<font color='blue'><tt>",
+ sprintf("%A",reqtype),
+ "</font></tt>\n<br/>\n",
+ __("but it does not."),
+ "\n<br/>\n");
+ attempt['IsValid'] := false;
+ RETURN(false);
+ fi;
+ # END KM
attempt['Answer'] := rawans;
RETURN(true);
|