From: Michal MalĂ˝ Date: Fri, 19 Dec 2014 01:43:18 +0000 (+0100) Subject: Check that all required elements are present in the assignment array in titration... X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=e40595e10b4fd9a8ad6d666225aa1a78d7cb7c9e;p=Nine-Q.git Check that all required elements are present in the assignment array in titration curve suite --- diff --git a/src/face_generators/face_generator.adb b/src/face_generators/face_generator.adb index f27a4a7..6c2ee1d 100644 --- a/src/face_generators/face_generator.adb +++ b/src/face_generators/face_generator.adb @@ -408,7 +408,7 @@ package body Face_Generator is return OK; end Generate_Face_Solubility; - + function Generate_Face_Titration_Curve(Assignment: in Problem_Generator_Syswides.Assignment_Info.Map; Answer_Message: in UB_Text; Answer_Code: in Problem_Generator_Syswides.Answer_RetCode; @@ -438,20 +438,79 @@ package body Face_Generator is Insert(Translations, Assoc(RESERVED_PROBLEM_CATEGORY_KEY, RESERVED_PROBLEM_CATEGORY_KEY)); Insert(Translations, Assoc(RESERVED_PROBLEM_CATEGORY_VAL_KEY, Pr_Cat)); -- Assignment + if Assignment.Find(Titration_Curve_Suite.SAMPLE_CONC_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_CONC_INT_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_CONC_INT_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_CONC_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_CONC_DEC_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_CONC_DEC_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_CONC_EXP_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_CONC_EXP_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_CONC_EXP_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_TYPE_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_TYPE_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_TYPE_KEY))); + + if Assignment.Find(Titration_Curve_Suite.TITRANT_TYPE_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.TITRANT_TYPE_KEY, Assignment.Element(Titration_Curve_Suite.TITRANT_TYPE_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_VOLUME_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_VOLUME_INT_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_VOLUME_INT_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_VOLUME_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_VOLUME_DEC_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_VOLUME_DEC_KEY))); + + if Assignment.Find(Titration_Curve_Suite.SAMPLE_VOLUME_EXP_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.SAMPLE_VOLUME_EXP_KEY, Assignment.Element(Titration_Curve_Suite.SAMPLE_VOLUME_EXP_KEY))); + + if Assignment.Find(Titration_Curve_Suite.TITRANT_CONC_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.TITRANT_CONC_INT_KEY, Assignment.Element(Titration_Curve_Suite.TITRANT_CONC_INT_KEY))); + + if Assignment.Find(Titration_Curve_Suite.TITRANT_CONC_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.TITRANT_CONC_DEC_KEY, Assignment.Element(Titration_Curve_Suite.TITRANT_CONC_DEC_KEY))); + + if Assignment.Find(Titration_Curve_Suite.TITRANT_CONC_EXP_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.TITRANT_CONC_EXP_KEY, Assignment.Element(Titration_Curve_Suite.TITRANT_CONC_EXP_KEY))); + + if Assignment.Find(Titration_Curve_Suite.PKX1_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.PKX1_INT_KEY, Assignment.Element(Titration_Curve_Suite.PKX1_INT_KEY))); + + if Assignment.Find(Titration_Curve_Suite.PKX1_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.PKX1_DEC_KEY, Assignment.Element(Titration_Curve_Suite.PKX1_DEC_KEY))); + + if Assignment.Find(Titration_Curve_Suite.PKX2_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.PKX2_INT_KEY, Assignment.Element(Titration_Curve_Suite.PKX2_INT_KEY))); + + if Assignment.Find(Titration_Curve_Suite.PKX2_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Titration_Curve_Suite.PKX2_DEC_KEY, Assignment.Element(Titration_Curve_Suite.PKX2_DEC_KEY))); -- Insert(Translations, Assoc(Titration_Curve_Suite.ANSWER_PH_START_KEY, Titration_Curve_Suite.ANSWER_PH_START_KEY)); @@ -476,6 +535,10 @@ package body Face_Generator is case Answer_Code is when Correct_Answer => + if Assignment.Find(Titration_Curve_Suite.TITRATION_CURVE_IMAGE_PATH_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; + Insert(Translations_Answer, Assoc(ANSWER_KIND_KEY, ANSWER_KIND_GOOD)); Insert(Translations_Answer, Assoc(ANSWER_MESSAGE_KEY, UB_Text_To_Fixed_String(Answer_Message))); Insert(Translations_Answer, Assoc(Titration_Curve_Suite.TITRATION_CURVE_IMAGE_PATH_KEY, Assignment.Element(Titration_Curve_Suite.TITRATION_CURVE_IMAGE_PATH_KEY)));