Problem with feedback.

Re: Problem with feedback.

by Tim Hunt -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, if you have direct access to the database, you probably can update thing in bulk, but it will be a bit risky, so take suitable precautions (backups) if you decide to try this.

The first thing would be to make an SQL query that just gets the right data, which might be something like this

SELECT q.id, q.name, answer.feedback, answer.feedbackformat
FROM mdl_question q
JOIN mdl_question_answers answer ON answer.question = q.id
WHERE answer.fraction = 1

Note, I have not tested any of these queries. They are approximately right, but you will need to fix the details yourself. You may need to add some extra WHERE clauses to limit this to just the questions you recently imported.

Once you are sure that is associating the right feedback with the right question, you can then try to write the corresponding update. The syntax for UPDATE queries with a JOIN is different depending on what type of database this is (MySQL, Postgres, etc.). You may need to use subqueries rather than a join. I would need to read the database manual to work it out, and I don't have time now. (I also don't know which DB you are using). Hopefully you know enough SQL that you can solve it.

Average of ratings: Useful (1)