Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-4311

Avoid sending NaN as number webservice parameters

XMLWordPrintable

    • Hide

      After submitting a quiz, the review should be displayed without showing any errors (before this fix, the webservice error about NaN would be showed). Make sure that the quiz review includes the feedback field, or else this bug wouldn't have been reproduced.

      Show
      After submitting a quiz, the review should be displayed without showing any errors (before this fix, the webservice error about NaN would be showed). Make sure that the quiz review includes the feedback field, or else this bug wouldn't have been reproduced.
    • MOODLE_401_STABLE
    • MOODLE_402_STABLE
    • Moodle App 4.2.0

      Whilst testing quiz, we realized that in some situations the following error is returned when calling webservices:

      Invalid external api parameter: the value is "NaN", the server was expecting "float" type

      Looking into this, the problem is related with a string that is parsed into a Number but wasn't one. In particular, the returned grade was the string "-" instead of a number. This is to be expected, but because NaN has type number in TypeScript, this error hasn't been caught with the type system.

      This can be solved by simply adding an if before calling the webservice, but this fix leaves the door open for this error happening again in the future. So the correct solution should involve introducing type safety here (maybe using Branded types).

            noeldemartin Noel De Martin
            noeldemartin Noel De Martin
            Dani Palou Dani Palou
            Isabel Renedo Rouco Isabel Renedo Rouco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.