jesusmmp / exams2sakai

Automatic Generation of Exams in R for Sakai LMS
3 stars 0 forks source link

Line breaks in Solution section #2

Open JayOBee opened 2 months ago

JayOBee commented 2 months ago

I have issues with line breaks in the Solution section of a question:

library(exams2sakai)
exam <- c("relfreq", "regression")
exams2sakai(exam, name = "exam") 

produces this xml-output within the itemfeedback section for the exercise relfreq or other exercises with line breaks (should continue after </br>]]>):

<mattext texttype="text/html">
<![CDATA[<p>In the percentage table, the row sums are about 100 (except for possible rounding errors).</br>]]>
</mattext>

and this xml-output for the exercise regression (seems OK):

<mattext texttype="text/html">
<![CDATA[<p>First, the regression line <span class="math inline">\(y_i = \beta_0 + \beta_1 x_i +
\varepsilon_i\)</span> is determined. The regression coefficients are given by: 
...
</p>]]>
</mattext>

Seems to me that there is a problem around lines 211-212, so I created a simple workaround by

comcor <- paste0(xsolution, "<br />") 
comincor <- paste0(xsolution, "<br />")

but I'm sure that there are better ways.

My system information:

platform       x86_64-w64-mingw32 
version.string R version 4.4.1 (2024-06-14 ucrt)

Great package though! I'll start using it in my courses this semester. Thanks!

jesusmmp commented 2 months ago

Hi @JayOBee!

Let me take a look!

For the relfreq example should be the same correct and incorrect feedback?

In the percentage table, ther rowsums[variant]are about 100 (except for possible rounding errors). Hence, the table providesr percentage[variant]percentages, i.e.,r interpretation[variant]``

Thanks!

JayOBee commented 2 months ago

Thanks for taking your time!

To me, it would make most sense to provide the same correct and incorrect feedback, as the exercises in exams do not distinguish between correct and incorrect feedback. That only seems to be a feature in Sakai/Tests & Quizzes.

jesusmmp commented 2 months ago

You can add correct and incorrect feedback on this way:

+ Text for correct feedback
- Text for incorrect feedback

Remember you have meta-information extra for multiple choice questions added on this package

exsingle: TRUE # mcss (multiple correct single selection) exsingle: FALSE # mca (multiple correcta answer)

JayOBee commented 2 months ago

Maybe let's leave correct and incorrect feedback aside for a second. My issue with the line breaks is illustrated better as follows:

library(exams2sakai)

question <- "Question
========
A question

Answerlist
----------
* A
* B
* C

Solution
========
First line of feedback
Second line of feedback

Meta-information
================
exname: test
extype: schoice
exsolution: 100"

connection <- file("exercise1.Rmd")
writeLines(question, connection)
close(connection)

exams2sakai("exercise1.Rmd")

This results in a zipped qtisakai.xml, which in lines 158-160 only shows the first line of feedback, but it should contain the "second line of feedback" as well:

<mattext texttype="text/html">
<![CDATA[<p>First line of feedback</p>]]>
</mattext>

and line 168 only contains <![CDATA[<p>NA]]>

Now back to correct/incorrect feedback: I'm not sure how to exactly implement the text for correct and incorrect feedback. If I try like this:

library(exams2sakai)

question <- "Question
========
A question

Answerlist
----------
* A
* B
* C

Solution
========
+ Correct feedback
- Incorrect feedback

Meta-information
================
exname: test
extype: schoice
exsolution: 100"

connection <- file("exercise2.Rmd")
writeLines(question, connection)
close(connection)

exams2sakai("exercise2.Rmd")

it gives me a qtisakai.xml, in which line 159 only contains <![CDATA[<ul></p>]]> and line 168 consist of <![CDATA[<p>NA]]> Did I get this all wrong? Thanks again!

jesusmmp commented 2 months ago

Thanks for the examples! Let me some time to take a look! :)