Search code examples
r-exams

R-exam mchoice: Error in moodlePercent(frac) : Percentage not in list of moodle fractions


I have an mchoice question in file 32_est_summary.Rmd in this public repo. (I don't share the code here since it is a bit large and stack over flow policies don't allow me to publish the question with all the code)

The question renders without problem in html format using

exams2html("32_est_summary.Rmd",
           converter = "pandoc-mathjax")

However, there is an issue when trying to export it as XML. In file 32_est_summary.Rmd line 36, I have a variable which controls the number of random generated false answers (nrep). If nrepis equal to 2, then I get the following error message:

Error in moodlePercent(frac) : Percentage not in list of moodle fractions

Is this normal? Is there any way to fix it?


Solution

  • In Moodle only certain percentage values are available for scoring a given item, namely:

    exams:::moodleFractions
    ##  [1] 100.00000  90.00000  83.33333  80.00000  75.00000  70.00000  66.66667
    ##  [8]  60.00000  50.00000  40.00000  33.33333  30.00000  25.00000  20.00000
    ## [15]  16.66667  14.28571  12.50000  11.11111  10.00000   5.00000
    

    Your item has 28 answer alternatives and thus there is a good chance that a percentage is required for scoring that is not available in the list above. Thus, you either need to reduce the number of answer alternatives or switch to a different question format.

    In your case I would recommend to switch the extype to cloze and split up the exercise into subitems. For example, you have something like:

    * El estimador del cuantil 0.5 es 64.22
    * El estimador del cuantil 0.5 es 14.4832
    * El estimador del cuantil 0.5 es 209.7624
    * El estimador del cuantil 0.5 es 52.3775
    * El estimador de la mediana es 64.22
    * El estimador de la mediana es 209.7624
    * El estimador de la mediana es 52.3775
    * El estimador de la mediana es 77.2675
    

    Either you can switch it to clozetype as schoice|schoice, i.e., two single-choice answer list with one correct solution each. Or you can switch that to clozetype as num|num with

    * El estimador del cuantil 0.5 es:
    * El estimador de la mediana es: