moodleou / moodle-quiz_answersheets

A Moodle quiz report to allow quiz attempts to be exported
8 stars 15 forks source link

Is MTF question type supported? #23

Closed dinism closed 3 years ago

dinism commented 4 years ago

imagem

timhunt commented 4 years ago

Well, it appers not. Howver, you have give given the error message by taking a screen-grab where the ends of all the lines are cut off, so it is hard to be sure. Could you not have copied and pasted thefull error text.

Note: the error message is coming from the Moodle core question system. not the answersheets plugin. Do you acutally have the mtf plugin installed? The error message suggests not. Perhaps you installed it in the past, created some questions, then deleted the mft plugin?

dinism commented 4 years ago

I have MTF question installed. Moodle 3.9. MySQL. Now i get this: imagem

timhunt commented 4 years ago

As I said above: copying and pasting the text of an erorr message as an image makes it infinitely less useful. Also, what did you do immediately before getting that error?

It could be that the plugin does not fully work on MySQL yet, although the automated tests pass with it, so it mostly works.

dinism commented 4 years ago

I have now only mutichoice and true/false questions in quiz. I made a new quiz with just one student response.

Error reading from database

More information about this error

Debug info: Unknown column 'answer_sheet' in 'order clause' SELECT DISTINCT CONCAT(u.id, '#', COALESCE(quiza.attempt, 0)) AS uniqueid, (CASE WHEN (quiza.state = 'finished' AND NOT EXISTS ( SELECT 1 FROM mdl_quiz_attempts qa2 WHERE qa2.quiz = quiza.quiz AND qa2.userid = quiza.userid AND qa2.state = 'finished' AND ( COALESCE(qa2.sumgrades, 0) > COALESCE(quiza.sumgrades, 0) OR (COALESCE(qa2.sumgrades, 0) = COALESCE(quiza.sumgrades, 0) AND qa2.attempt < quiza.attempt) ))) THEN 1 ELSE 0 END) AS gradedattempt, quiza.uniqueid AS usageid, quiza.id AS attempt, u.id AS userid, u.idnumber, u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.firstname,u.lastname, u.picture, u.imagealt, u.institution, u.department, u.email, quiza.state, quiza.sumgrades, quiza.timefinish, quiza.timestart, CASE WHEN quiza.timefinish = 0 THEN null WHEN quiza.timefinish > quiza.timestart THEN quiza.timefinish - quiza.timestart ELSE 0 END AS duration, quiza.attempt AS attemptno , CASE -- If, for this user, attempts allowed (including overrids) is unlimited, -- then they have not used all attempts. WHEN COALESCE( (SELECT attempts FROM mdl_quiz_overrides WHERE quiz = quiza.quiz AND userid = u.id), (SELECT MIN(overrides1.attempts) FROM mdl_quiz_overrides overrides1 JOIN mdl_groups_members overrides1_gm ON overrides1_gm.groupid = overrides1.groupid WHERE overrides1.quiz = quiza.quiz AND overrides1_gm.userid = u.id), ?) = 0 THEN 0 -- Or, if there is a finite limit, compare with the number of attempts they have. WHEN (SELECT COUNT(1) FROM mdl_quiz_attempts WHERE quiz = quiza.quiz AND userid = quiza.userid) < COALESCE( (SELECT attempts FROM mdl_quiz_overrides WHERE quiz = quiza.quiz AND userid = u.id), (SELECT MAX(overrides2.attempts) FROM mdl_quiz_overrides overrides2 JOIN mdl_groups_members overrides2_gm ON overrides2_gm.groupid = overrides2.groupid WHERE overrides2.quiz = quiza.quiz AND overrides2_gm.userid = u.id), ?) THEN 0 ELSE 1 END AS used_all_attempts , CASE -- User does not have an attempt yet, so only one row. WHEN quiza.id IS NULL THEN 1 -- User woth one or more attempts. WHEN quiza.attempt = ( SELECT MAX(attempt) FROM mdl_quiz_attempts WHERE quiz = quiza.quiz AND userid = quiza.userid ) THEN 1 ELSE 0 END AS last_attempt_for_this_user

FROM mdl_user u LEFT JOIN mdl_quiz_attempts quiza ON quiza.userid = u.id AND quiza.quiz = ? JOIN mdl_user_enrolments ej1_ue ON ej1_ue.userid = u.id JOIN mdl_enrol ej1_e ON (ej1_e.id = ej1_ue.enrolid AND ej1_e.courseid = ?) JOIN (SELECT DISTINCT userid FROM mdl_role_assignments WHERE contextid IN (1,85,87,88,91,265) AND roleid IN (5) ) ra ON ra.userid = u.id WHERE (quiza.preview = 0 OR quiza.preview IS NULL) AND 1 = 1 AND u.deleted = 0 AND u.id <> ? AND u.deleted = 0 ORDER BY answer_sheet DESC, submit_student_responses DESC, quiza.id ASC LIMIT 0, 30 [array ( 0 => '0', 1 => '0', 2 => '4', 3 => '4', 4 => '1', )] Error code: dmlreadexception Stack trace:

line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 2002 of /lib/tablelib.php: call to mysqli_native_moodle_database->get_records_sql()
line 587 of /mod/quiz/report/attemptsreport_table.php: call to table_sql->query_db()
line 2024 of /lib/tablelib.php: call to quiz_attempts_report_table->query_db()
line 171 of /mod/quiz/report/answersheets/report.php: call to table_sql->out()
line 97 of /mod/quiz/report.php: call to quiz_answersheets_report->display()
timhunt commented 4 years ago

This bug is triggered by clicking on the "Answer sheets" column header. This tries to get the table to sort on that column, which as the error shows, cannot work.

So: work-around: don't do that!

You can get rid of the error by logging out and logging in again, which resets your table sorting preferences.

dinism commented 4 years ago

Ok. Thanks A LOT. As you said in tracker, ..."at least one person like it...". YES i like it and i voted. I'm a PT-PT translator and it's done for portuguese. WAITING AMOS... In review sheet, why it shows the question instrution before question?

timhunt commented 4 years ago

"In review sheet, why it shows the question instrution before question?" - probably because we did not think about that case. However, we are already in the middle of adding a manual option for whether to show the instructions, so we will probably leave it at that - it might be good if the printed review sheet matches the blank answer sheet the student completed. Thanks for your feedback.

dinism commented 4 years ago

Is it possible to remove header and footer?

timhunt commented 4 years ago

No.