Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-34846

Allow the instructor to include extra calculations within the calculated question



    • Type: Feature Request
    • Status: RESOLVED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9.1
    • Fix Version/s: 10.0
    • Labels:
    • Previous Issue Keys:


      Currently there is no way to reference a calculated value in the calculated question unless it is part of the formula for the answer. Extend the existing Calculated Question work in order to allow the instructor to include calculations within the question itself. I.e. the instructor could set up a question something like the following:

      Alice has

      {A} apples, Bob has {B} apples, and Charles has {C} apples. Of the [[{A}


      {B} + {C}]] apples among the group, SOLUTION percent are Bob's.
      Formula: SOLUTION = ({B}

      / (

      {A} + {B} + {C}))*100

      Wherein if the variable values were A=5, B=10, C=15, the actual display to the student would look like:

      Alice has 5 apples, Bob has 10 apples, and Charles has 15 apples. Of the 30 apples among the group, (TEXT ENTRY BOX HERE) percent are Bob's?

      Allowing the formula to be embedded WITHOUT {} around the variable names means that the embedded formula has to be converted from "{A + B + C}" into "{A}


      {B} + {C}". This won't generally work, because something like "COS" or other text used in the formula confuses the parser, it can be quite difficult to detect when the C in COS is a variable and when it is part of a special word.
      One possible solution here is to force another variable delimiter to be used when writing the embedded formulas (like []). This also will keep the embedded formula variables from interacting with the regular replaced variable and serves as a type of indicator that these are not DEFINED variables but simply references to the defined variables. That can cause issues when the variables in the calculation do not match with the other variables in the item.
      It probably makes the most sense to write the variables with braces in the embedded formula like: {{{{A} + {B}

      + {C}}}} or more likely with a different set of brackets like [[

      {A} + {B} + {C}]]. This way any variables in the calculation are included in the scan and replace processing that already happens.
      The final alternative here is to simply define an additional formula name like {TOTAL} which is then entered below just like the formulas which are replaced by input boxes. TOTAL = {A}





        Gliffy Diagrams



            1. SAM-2151.patch.txt
              66 kB
            2. SAM-2151.patch.txt
              62 kB
            3. SAM-2151.patch.txt
              54 kB
            4. SAM-2151.patch.txt
              49 kB
            5. Sample-question-edit.png
              100 kB
            6. Sample-question-take.png
              18 kB

              Issue Links



                  aaronz Aaron Zeckoski (Inactive)
                  carrowood Charise (Inactive)
                  0 Vote for this issue
                  3 Start watching this issue



                      Git Integration