Мнения, написани от Ray Morris

If question attempts have answers recorded, but they are the "needsgrading" state, which function(s) need to be called to get them graded?  Or should they be graded at the time that answers are saved?


Background:

I am updating the papercopy module to work with Using Moodle 2.8, and making some improvements.  The module follows roughly this series of steps:


$usage = question_engine::make_questions_usage_by_activity

foreach($quiz_questions

    $usage->add_question($question);

}

...


//enter the student's answers for each of the questions

foreach($slotsas$slot){

$usage->process_action($slot, array('answer' =>$set['Question'.$slot]-1));

}

...


question_engine::save_questions_usage_by_activity($usage);

$attempt=newstdClass();

$attempt->quiz =$this->quiz->id; ...

$attempt_object=new quiz_attempt($attempt, $this->quiz, $this->cm, $this->course, true);

$attempt_object->process_finish(time(), true);


The full code is here:

https://github.com/MorrisR2/moodle-quiz_papercopy/blob/create_user_if_not_exist/report.php


What we end up with is a quiz attempt shows in the reports, and clicking on "Review attempt" shows which answers were selected for the questions, but the questions are as-yet ungraded.  The "state" of the question attempts == $needsgrading. What needs to be done to have the questions / quiz graded?




One of the relevant tables was renamed, but assuming Moodle 2.7 or higher:


I haven't tested this, but it should be something like:


SELECT id, course, name FROM mdl_quiz WHERE id IN 

(SELECT quizid FROM mdl_quiz_slots WHERE questionid=:QUESTIONID)

Used vs unused is not specific to a certain course or quiz.  So if you search for "used" questions in a category it shows questions used in ANY quiz, anywhere on the site.


This is a pretty new plugin, so it wouldn't hurt to double check my work by looking for a question that you know to be used in some other quiz.  It's an extremely simple plugin, though, so I don't think it has any bugs.

Damyon, I'm not sure which of three things you're wanting.  Two are included in the CSS I suggested, the other I've never seen implemented anywhere.  I think you're wanting the first case, which is included.   This is easy:

<div lang="en-us">Flashlight</div>

<div lang="en">Torch</div>


That's the last bit I mentioned in my initial post "the most specific language first (the en-us version would come before the generic en version, unless they are one and the same)."


You can also do this, where multiple languages have the same text:

<div lang="en es">soda</div>

<div lang="fr">soudeo</div>



Are you saying you'd like to do this?:

Write text in Spanish and in English.

Some users see the Spanish text.

Some users see the English text.

Some users see BOTH the Spanish and the English.


Indeed I don't think that's supported in Moodle, and if it's supported in HTML I'd like to see a reference for it.  The specs I've read gives a list of languages by PRIORITY, and it uses the ONE language with the highest priority.