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

Provide better user messages for calculated questions that have errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: OPEN
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 11.5 [Tentative], 12.1, 19.0
    • Fix Version/s: None
    • Labels:
      None
    • Test Plan:
      Hide

      Please add a Test Plan here.

      Show
      Please add a Test Plan here.

      Description

      When calculated questions fails to extract the answers correctly it gives an not very helpful message. The error displayed is

      "401: Result is not a number (NaN) :ABS(23-23/3/3)"

      An example formula that would generate an error currently is

      {x}-{x}

      where x is negative.

      We should probably use the exp.checkSyntax() method of mxParser to validate that the string and exp.getErrorMessage() to display the error message (if this error message is appropriate for users)

      I'm not sure what to do on old incompatible equations that were created prior to mxParser, but luckily there doesn't seem to be many of those. Perhaps we should also do something about these. Previous calculated questions end up returning a null array from this code in DeliveryActionListener.java

      2359      List<String> texts = service.extractCalcQAnswersArray(answersMap, item, gradingId, agentId);
      2360      String questionText = texts.get(0);
      

      And when texts.get(0) is called it's an ArrayIndexOutOfBoundsException

      I created SAK-39922 to add support for this and https://github.com/mariuszgromada/MathParser.org-mXparser/issues/130 has some more details about how to check and print errors (hopefully they're i18n).

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  ottenhoff Sam Ottenhoff
                  Reporter:
                  jonespm Matthew Jones
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                    Dates

                    Created:
                    Updated:

                      Git Integration