]> Devoid-pointer.net GitWeb - Nine-Q.git/commitdiff
Check that all required elements are present in the assignment array in titration...
authorMichal Malý <madcatxster@devoid-pointer.net>
Fri, 19 Dec 2014 01:43:18 +0000 (02:43 +0100)
committerMichal Malý <madcatxster@devoid-pointer.net>
Fri, 19 Dec 2014 01:43:18 +0000 (02:43 +0100)
src/face_generators/face_generator.adb

index f27a4a789bbf1432e432a24e5f45793f882eb0f2..6c2ee1d29c46ee3c125bfc178322dc6597731e6d 100644 (file)
@@ -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)));