Lessons - MySQL storage of student answers

Lessons - MySQL storage of student answers

Ron Raney -
Number of replies: 5

Moodle 2.5.2+

Hello. I am using the Lesson module in a course that I created. I have a question about the different question types available from within the Lesson module. I am using multichoice pages, content pages and essay pages for my lessons. I have gone through these lessons logged in as mock students and now I am trying to find my answers in the MySQL database. Basically, I cannot find data for the attempts or answers for the multichoice and essay questions. If anyone can tell me the tables to query for these types of questions I would appreciate it. I get empty sets when I querymdl_question_attempts and mdl_question_multichoice. I think mdl_lesson_attempts has some of the answers for multichoice, but I'm not sure.  I don't see mdl_question_essay anywhere. I really want up-to-date information about the structure of the Moodle database. A lot of the documentation that I have found is out of date or just not helpful. Basically, I am interested in knowing more about exactly which tables hold the data that students enter in the Lessons. 

 

Thanks!

 

Ngā whakawākanga toharite: -
In reply to Ron Raney

Re: Lessons - MySQL storage of student answers

Joseph Rézeau -
Pikitia o Core developers Pikitia o Particularly helpful Moodlers Pikitia o Plugin developers Pikitia o Testers Pikitia o Translators

Hello Ron,

The students' answers are saved in the useranswer field of the (mdl_)lesson_attempts table.

screenshot #1

Just out of curiosity, why do you need to know the contents of those tables? Are you planning to add a new feature to the Lesson activity?

Joseph

EDIT.- Please note that some of the students' answers are serialized. For instance, an essay with student answer "hello world!" would be stored as this string in the useranswer field:

O:8:"stdClass":6:{s:4:"sent";i:0;s:6:"graded";i:0;s:5:"score";i:0;s:6:"answer";s:19:"<p>hello world!</p>";s:12:"answerformat";s:1:"1";s:8:"response";s:0:"";}

which, once un-serialized would look like this:

stdClass Object (

    [sent] => 0

    [graded] => 0

    [score] => 0

    [answer] =>

            hello world!

    [answerformat] => 1

    [response] =>

)

Ngā whakawākanga toharite: -
In reply to Joseph Rézeau

Re: Lessons - MySQL storage of student answers

Ron Raney -

Ok thanks! It was the serialized data that was throwing me off. That must be the essay answers. I will have to learn how to "un-serialize" unless exporting does that for you. 

I am using Moodle as part of a study - not for education per se. We are randomizing individuals as part of a web-based smoking cessation program. The data must be collected and exported for analysis - since it is for research purposes. Moodle is a great fit for our needs. We decided to use a Virtual Learning platform because it allows us to present material, ask questions, and access all kinds of information about the participants. I hope that answers your question. I am not really into modifying Moodle yet. I've only really modified the themes and added snippets of code. And I am trying to develop queries to get the data out of the database on the back-end. I'm sure I will use the front-end options, but I want to have my bases covered. The "email graded essays" hasn't been working for me - it draws an error or doesn't actually email me anything. I haven't really troubleshooted that yet. Another problem for another day?

Thanks for your help!

Ngā whakawākanga toharite: -
In reply to Ron Raney

Re: Lessons - MySQL storage of student answers

Lynette McDougal -

Hey Ron

I'm just wondering if you are still working on your Moodle Lesson and how you are handling it.

I have been put in charge of formatting a Moodle course for research purposes. The materials include fundamental engineering concepts and simulations. Throughout the lesson, students are asked essay questions (and a few multiple choice questions) as an attempt to capture their understanding of the materials. Ideally I'd like to be able to download (in a spreadsheet) all student responses for data collection purposes. I can easily download all responses into a spreadsheet for a Moodle Quiz activity, but I can't seem to figure out how to do this for a lesson activity. 

Your situation seemed similar to mine, so I thought I'd start here.

Thanks.

Lynette

Ngā whakawākanga toharite: -
In reply to Lynette McDougal

Re: Lessons - MySQL storage of student answers

Linda Bussell -

Hi Lynette,

I'm trying to do the same thing. Did you ever find the answer to your question?

Thanks,

Linda

Ngā whakawākanga toharite: -
In reply to Linda Bussell

Re: Lessons - MySQL storage of student answers

Jean-Michel Védrine -

Hello Ron, Lynette and Linda,

I think the right solution to this problem would be a button to download students' responses to lesson essay questions with a select menu to choose the file format for the download.

Something like this:

download lesson essay responses

But please note this is just an image I have made to show how it could look, I have not yet written the needed code to add this feature.

And even if this feature is integrated into Moodle in the future it will go in a future version, it will not be backported to older versions.

Unfortunately, for now I have other more urgent things to fix in the lesson module for instance MDL-43386 and MDL-45679 are IMHO really needed. It would also be good to have a way to give time/date extensions to individual students (this is MDL-7315 and MDL-27042 and is in fact the most voted tracker issue for the lesson component but it needs quite a lot of work)

I am a teacher so I work on the lesson module in my free time and my goal is to solve one or more lesson bug per week but so far I am quite satisfied of the results even if I have not started to work on the most complex issues menemene .

Unfortunately the number of open issues for the lesson module is quite big!

Ngā whakawākanga toharite: -