Mobile quizz spacing issue

37 views
Skip to first unread message

f.lewis

unread,
Sep 17, 2015, 11:14:37 AM9/17/15
to OppiaMobile
Good Day Alex,

The multi choice and short answer quizzes are not displaying correctly in the mobile app.  The problem is with the spacing of the text of the multi choice and short answer quizzes in the mobile app. I have attached three files to demonstrate the issue. The 1st attached pic shows how the question appears in Moodle; the 2nd pic (Progress Quiz - App incorrect.png) shows the way that the quizz is appearing now; and the 3rd pic (Progress Quiz - App correct.png) shows how we want the quizz to appear in the app.

I have spoken with our developer and he says the following:  "When Moodle Block exports the course -> it created an XML which contains quiz questions and responses..
We noticed, all the HTML tags like <p>, <br>, <b>, etc.. are gone into that XML"

Do you have a solution?

Cheers... fred
Progress Quiz - App correct.png
Progress Quiz - Moodle View.png
Progress Quiz - App incorrect.png

Alex Little

unread,
Sep 21, 2015, 1:31:07 PM9/21/15
to OppiaMobile

Realised that I'd only replied directly to Fred, rather than to this list, so here's my reply.....


When the questions are displayed in the app the control box for the text doesn't handle HTML. So currently when the questions are exported any HTML is stripped out.

To get the questions to display with all the line breaks there are couple of ways we could fix this:

Quick fix - in the moodle question text , put a \n where ever you need to force a new line. However the HTML will still get striped out, so anything e.g. in bold still won't display with HTML formatting.

Proper fix: in the app change the question display control to be one that will handle full HTML. Then in the middle block remove the line that strips out the HTML.

Hope that helps
Cheers
Alex

Alex Little

unread,
Sep 21, 2015, 2:00:01 PM9/21/15
to OppiaMobile
And a follow up response to the question/query:

As of now, we have applied some pattern matching regular expressions to match and replace some characters like ;nspb with Spaces and line breaks. But this doesn’t work well where we don’t have anything to match. So how to tackle this? Is there any way so we don’t strip the html tags while generating the XML ?

In the Moodle Oppia export block it specifically strips out the html. So to change this (and not strip out the html) you'd need to update the export block code, so that in the oppia_export_block/lib.php in the extractLangs function, it doesn't use the strip_tags function in line 71.

Updating the export block alone wouldn't then mean that the html is properly rendered in the app though, it;s very likely to display the html tags in the question 'as-is' without interpreting them. This is why the question control field in the app would need to be updated/changed to one that actually rendered html formated strings as expected.

Cheers,

Alex



On Thursday, September 17, 2015 at 6:14:37 PM UTC+3, f.lewis wrote:

Nitin Jain

unread,
Sep 28, 2015, 9:57:46 AM9/28/15
to OppiaMobile
Hi Alex,

I see an alternate solution which would probably make the life easier..

What if i write a cron script to be executed every minute on moodle server, which would check questiontext table data into moodle database and replace the <br> tags with \n.

this way, whenever we export the course it would always be a correct text and mobile app would show that fine.

what do you think?

regards
Nitin

Alex Little

unread,
Sep 29, 2015, 2:14:06 AM9/29/15
to oppia...@googlegroups.com
Hi Nitin,

That solution would work I guess, but doesn't really feel right to me - and much more of a hack/workaround that a real fix.

I think the best option would just be to remove the function that strips the tags in the Moodle block - (see: https://groups.google.com/d/msg/oppiamobile/Zi41NXTLqPs/CztbdUKUAwAJ) and the update the TextViews in Android app quiz display so they render the HTML.

This way you can have quiz questions that have bold/italic text etc and some other formatting that's currently not possible - so not only the line breaks.

Cheers,
Alex
--
You received this message because you are subscribed to the Google Groups "OppiaMobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oppiamobile...@googlegroups.com.
To post to this group, send email to oppia...@googlegroups.com.
Visit this group at http://groups.google.com/group/oppiamobile.
To view this discussion on the web visit https://groups.google.com/d/msgid/oppiamobile/c8baef86-13f0-4935-b9a5-ccbc0d59a32f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Alex Little
Director, Digital Campus
al...@digital-campus.org
http://digital-campus.org
mobile (UK): +44 7548 236 650
skype: alexlittleou
twitter: @digicampusteam & @alexlittle

Nitin Jain

unread,
Sep 30, 2015, 1:43:17 AM9/30/15
to OppiaMobile
 Hi Alex,

Thanks for your email..

Actually, as advised we tried to remove the strip_tags function at line 71 under /lib.php but that doesn't make any difference. Then i tried to dig into that more and found it doesn't go into that else condition actually. it goes into else if condition and returns the $content at line 68.

Could you please check and advise?

Regards
Nitin
~~~~

Alex Little

unread,
Oct 1, 2015, 7:10:53 AM10/1/15
to oppia...@googlegroups.com
Hi Nitin,

Just been having a look at this. The strip_tags function on line 71 is the right one to remove, but I think I know why it may not be appearing to work when you try it...

When a quiz is exported for the first time, all the questions etc are replicated/exported onto the Oppia Server, and it returns a digest (fingerprint) for this quiz. So when the course is exported again, the export block can recognise that this exact quiz has already been created, so it just uses the original quiz definition.

There are 2 ways to force the quiz to get recreated:
1) remove the quiz from the Oppia server (you can do this through the django admin pages) - then when you export the course again, it'll get recreated
2) change the quiz in Moodle in some way - then when you export the course again, it will be identified as a new quiz on the Oppia server and will create the questions with all the html in them

Hope that helps,
Cheers,
Alex

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages