Grading Within an Essay

Grading Within an Essay

Rachael Ayre
Vastuste arv 14
I am having trouble dressing within an essay in 2.1. Under the grading essay tab, it says there are no essays in the lesson, but under the reports tab, I can see the student essay content. However, the content is surrounded in HTML code. Is there something I am not choosing properly in my essay creation?
Keskmine hinnang: -
Vastuses Rachael Ayre

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Hi Rachel,

I really see no reason why you are getting this problem. If your lessons contains an essay, and a student has answered it, and you can see that student's essay's contents in the Reports tab upon clicking on the student's Attempt, then you should be able to grade that essay from the Grade essays tab.

I do not understand what you mean by "However, the content is surrounded in HTML code." It would help me visualize things if you would attach a screenshot to your reply.

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Rachael Ayre
Vastuses Rachael Ayre

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Hi Rachel,

Well, that Esssay seems to contain lots of "weird" characters, maths formulas or something. Those may be causing the problem you described in your original post.

Could you please attache the exact contents of that Essay in a text file (utf8-encoded) attached to your reply so I can test it out on my local Moodle?

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

Hi Joseph,

Thank you for responding and trying to help us (I work with Rachael and she has asked me to respond).

The problem that she's talking about has nothing to do with the maths formulae.  We have repro'd the problem with a much simpler example.

To start I should tell you that we are in Moodle 2.1.  I updated my local test site to the latest stable build just now, because I saw this bug and thought it might be related: http://tracker.moodle.org/browse/MDL-29201.  However, the problem still exists there.

Now, steps to repro:

1. Create a lesson - if you need more detail, ask Rachael to tell you what settings she used, but AFAIK she just used all defaults when trying this test with me.

2. Create an essay question.  This one is about as simple as it gets, there don't seem to be any options except points and jump.  In the test lesson, this is the whole lesson, FWIW.

simple essay question

3. As a student, answer the essay question. Note that HTML format is all that shows up for us, I don't know if it is related.

4. As an admin or a teacher, go to grade the essay, using the Grade essays tab in the lesson.  Observed: the tab has this message: No essay questions found in this lesson., and nothing else.

 

Essay question missing in lesson that has an essay question for sure

5. Go to the Reports tab of the lesson.  Observed: your one or more attempts will show in Reports overview, because you did in fact attempt to answer the essay question, however many times.

6. Drill down into one of the attempts in the Reports tab.  Observed: your attempted answer shows, but not exactly as expected; the answer is rendered as HTML code rather than the end-product of that code.  This is what Rachael meant by saying "However, the content is surrounded in HTML code."

I'll attach a screen shot or something but just FWIW in my simple test case we're talking about a value that looks like

<p>test</p>

when I would have expected it to say

test

Additionally, the class statistics say "No one answered this question."

... hope this clarifies the problem, which is pretty serious for us at the moment.  And again we very much appreciate your trying to help.

Additional comment: I restored Rachael's lesson from her earlier test when I tried on my local box.  So the essay question itself was not created after my upgrade.  I don't know if this has any bearing on the problem.  I will try to create one from scratch on the upgraded local instance, and I'll write back if I see anything different, but I'm a DBA <g>.  I'm not exactly quick at content creation.

screen shot of answer to essay question in the Report detailed view

Vastuses Lisa Nicholls

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Hi Lisa,

I followed your scenario and things work as expected for me, i.e. when I have created an Essay question inside a Lesson instance, either I get the message "No one has answered an essay question yet." (if no-one has answered yet) or I can see the Essays in the Grade Essays tab.

So there definitely seems to be something wrong with your moodle installation, not with Moodle itself.

You say "I updated my local test site to the latest stable build just now." Did you upgrade from a 1.9.x version to 2.0 or directly to 2.1 or is this a brand-new 2.0 or 2.1 installation?

Do try to create a new lesson from scratch, to eliminate all "trailing" problems.

Joseph

EDIT.- you wrote"
I'll attach a screen shot or something but just FWIW in my simple test case we're talking about a value that looks like
<p>test</p>
when I would have expected it to say
test"

That is a different problem, which I reported  as MDL-29839.

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

Thank you Joseph.

I do realize that the HTML tags are a different problem, just explaining Rachael's original comments about this, which you followed up with a concern about all the special characters. I also the attendant comments in the forums here regarding this bug, but for some reason I thought that the latest stable build would already have the bug resolved. Misread the threads, I guess.  I can patch for this.

I have already created a new question from scratch, same problem, but it was within the existing lesson.

I can also tell you that Rachael created a new lesson from scratch, in a small course created in 2.1.something, and saw the problem.  But she did that on an instance that had *not* been patched up to the build I have downloaded today. It is Moodle 2.1.1+ (Build: 20110817)  I backed up her course and restored it to my local, because as I've told you I have little clue how to create a course and a lesson in Moodle. 

I will create a course and a lesson from scratch in my local install, if you think that's necessary.  Read on.

Regarding our installations: my local instance was originally a 2.0 (IOW it is not brand new) and I have applied successive builds to it, first to 2.1 and then up from there, as we discovered problems that we needed to resolve. 

If you like I can set up a brand-new instance of the same build I downloaded today and try again. Or should I just go ahead and create a new course and a new lesson in it, in the existing instance?

If it does work, either way, I can try to examine the underlying data to figure out what's different in the "old" essay questions and responses.  My real concern is to get that data back for the kids and the existing courses, naturally.  Maybe you can give me some pointers about where to look.

Thanks again

Update: I created a brand new instance locally.  I created a new course and a new lesson and just put one essay question in it; everything should be at its defaults as far as I know.  I see the same behavior.

Windows environment, running under IIS.  Is that a difference that matters?

Moodle 2.1.2+ (Build: 20111019)

Anything else I can tell you that would help?

Again, so far the most similar-looking report I found is here http://tracker.moodle.org/browse/MDL-29201 -- if you tell me where to find the "question state" in the database I would look at this.

Thanks again.

>L<

Vastuses Lisa Nicholls

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Lisa "Windows environment, running under IIS.  Is that a difference that matters?"

I have no idea what Windows IIS is, I only use Apache. If that is the problem, then you'd have to find through the moodle.org forum, someone using that environment and moodle 2.1 , and ask them if they are experiencing the "essays not found" problem you are experiencing.

The script to examine is mod/lesson/essay.php. Especially look around lines 255 etc. and use print_object to find out if you are getting essay pages.

case 'display':  // Default view - get the necessary data
    default:
        // Get lesson pages that are essay
        $pages = $lesson->load_all_pages();
        foreach ($pages as $key=>$page) {
            if ($page->qtype !== LESSON_PAGE_ESSAY) {
                unset($pages[$key]);
            }
        }
        if (count($pages) > 0) {

I'm afraid there is not much more I can do to help, since the problem seems to happen only on your particular environment,

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

Sorry, Joseph, I didn't seriously think that the web server is involved here, but there *is* a chance that the db is involved.  My environment is SQL Server.  I was writing fast yesterday and meant to say that.

I will chase up the code you pointed me to, and do whatever debugging I can, so thank you for that, but I really am a DBA and not a PHP programmer <g>.  So, if you could possibly do this, can you send me a snapshot of what *good* data would look like for an essay question?

I should be able to compare it pretty easily with what I have in my "clean" local installation, considering that it only has one course, one lesson, and one question.

I'm betting that you use MySQL; in phpMyAdmin or similar tools you can script the data for the relevant rows.  I can take a look at them and see what might be wrong. 

As I mentioned before I think that question status might be involved, based on another resolved bug but I don't know where to look for this.

Thank you again. 

>L< 

Vastuses Lisa Nicholls

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Yes, it might be the database type (or even the PHP version?). The way that the essay data is retrieved from the database is different when getting it (1) from the Grade Essays tab and (2) when getting it to display a student's activity. This may explain why you cannot see any essays from "Grade Essays" whilst you can see them in the individual students' activity.

Since you can see the essays in (2), it means the essays (and the students' answers) are saved OK in your database. That is why in my previous message I pointed you to the script in mod/lesson/essay.php, around lines 255. Unfortunately, since I am not using the same type of database (MySQL) as you are using I cannot conduct tests. You should really post to the Developer forum and try and find out someone who is using the same type of environment as you are (and still using moodle 1.9) to find out whether they are having the same problem as yours.

You could also post to the bug tracker: http://tracker.moodle.org

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

I really don't mean to be a pest, or to beat a dead horse here,  but...

The bug I pointed to, http://tracker.moodle.org/browse/MDL-29201, in my first message on this thread indicated that there might be a problem with *status* of the essay attempt, not its *contents*, that would prevent the attempt from showing up in the manual grading report -- the symptom described is exactly what is happening to us.

The bug also indicates that the problem would only affect 2.0 users.

 Yes, it is a limited connection, since the issue appears after regrading, but I would really like to be able to see what the question state is, versus what it is supposed to be.  I can't figure out how to do that.

Is there something in the developer docs that would tell me where I would find the "question state" or "question status" in the data schema?

Joseph:  I do understand that the answers are saved correctly to the database and that they are retrieved differently in the two tabs. 

I also understand that you are using MySQL (well, I didn't know for sure before you answered, but I was betting on it -- which is why I gave you the request for a script showing me a successful example of the data in the terms I did).  The difference in the database would not prevent me from seeing a difference in the actual attributes; I'll just parse that out of the INSERT statements you could script out of your table for me. 

If you can't do it, you can't, although I wasn't asking you to "conduct a test", just to give me an example of good data.  I certainly appreciate your attempts to answer anyway. 

I will do as much as I can on my own, including (thank you) playing with the code you pointed out, gather my findings, and then (yes) probably post a tracker item.  But I don't have real findings yet, as I see it.

I could also post to the Developer forum, but I am not sure why I would want to check with somebody who is still using 1.9 for this item?

JIC it makes any difference to anything: both sites running PHP 5.3.6.

 Thanks again.

>L<

Vastuses Lisa Nicholls

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Lisa, bug report MDL-29201 is about Essay in the Quiz activity, which has nothing to do with the Lesson activity we are concerned with.silmapilgutus

I hope you will find a solution to your problem. Don't hesitate to post to the bug tracker, including all the details about your database environment, etc.

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

Thanks Joseph.

I will not hesitate to post a bug, don't worry -- as soon as I've gathered proper details.  And I believe that maybe now I have naeratus.

I definitely did needed your help -- in the place you pointed me to, I used print_object and could see that the qtype was 10.  I could also see, elsewhere, that LESSON_PAGE_ESSAY is defined as "10".

Given that I am a DB person and not a PHP person, I suspected that the problem is a data type conversion. (I suppose it could be caused by this value being undef'd and redef'd somewhere I didn't see, but that's not likely -- or you would have the same problem I do.)

FWIW the datatype of qtype in mdl_lesson_pages in the SQL Server version is smallint.

For our temporary fix,  I've just substituted a literal 10 for the defined constant, and it works fine. 

     // Get lesson pages that are essay
        $pages = $lesson->load_all_pages();
        foreach ($pages as $key=>$page) {
            if ($page->qtype !==  10) { //LSN was: LESSON_PAGE_ESSAY)
                unset($pages[$key]);
               // here is where I could see it:
               // print_object($page);
            }
        }

Now that the teachers can see and grade essays, I'll post the bug and hope somebody will tell me the right way...

Thanks for the pointers.  I almost always *do* find a solution to my problem <g>.  This is just not my world...

>L<

Vastuses Lisa Nicholls

Re: Grading Within an Essay

Joseph Rézeau
Core developers pilt Particularly helpful Moodlers pilt Plugin developers pilt Testers pilt Translators pilt

Lisa "For our temporary fix,  I've just substituted a literal 10 for the defined constant, and it works fine. "

Yes, but... if I do that it no longer works on my moodle mySQL database! Please go ahead and post to the bug tracker so that hopefully we get - from a Moodle core developer - a solution which will work for all types of databases.

Joseph

Vastuses Joseph Rézeau

Re: Grading Within an Essay

Lisa Nicholls

Of course, Joseph, it isn't the right way to fix it -- and when I posted the bug report (which, naturally, I did immediately: http://tracker.moodle.org/browse/MDL-29873 ) I hope that I specified properly that this workaround, and the bug, was specific to use with MS SQL Server. 

With the caveat (again) that I am not a PHP developer and trying desperately not to become one...

IMHO the problem may very well not be in the lesson module.  I saw this in the pagetypes\essay.php file, and noted (in the bug report) that it might be okay or it might not:

define("LESSON_PAGE_ESSAY", "10");

-- in PHP, it may be okay that this is defined as a string, and it may be that mod\lesson\essay.php has access to this definition in the  other file. I am trying not to look too closely, because I don't have the tools or skills. 

If it *is* okay, then the issue is probably in whatever database management code in moodle is specific to MS SQL Server handling, and represent a datatype conversion problem -- in which case the fix would not be anywhere near this code and would be transparent to you and the lesson module.  I expect that a Moodle core developer will know that instantly, but neither Rachael nor I could have known that when we posted to this forum. 

I do hope that providing the hack in the bug report points the developer to where the problem actually this.  This  (beyond getting our installation to work properlly) makes -- also IMHO -- a more valuable bug report than just an accurate description of environment and steps to repro -- which of course I provided as well. <shrug>

>L<