mod_quiz_get_user_attempts returns empty array

mod_quiz_get_user_attempts returns empty array

by Xuan Dac -
Number of replies: 3

I am trying to get the attempt id for a user taking a quiz. How can I get an attempt id, before the user finishes the quiz?

I started an attempt via mod_quiz_start_attempt, it works, correctly and gives

{'errorcode': 'attemptstillinprogress',
 'exception': 'moodle_quiz_exception',
 'message': 'Attempt still in progress'}
However, when I try to get the attemptid via

       mod_quiz_get_user_attempts

it gives empty arrays as :

       'attempts': [], 'warnings': []

Average of ratings: -
In reply to Xuan Dac

Re: mod_quiz_get_user_attempts returns empty array

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
When you call mod_quiz_get_user_attempts, what arguments are you passing? https://github.com/moodle/moodle/blob/master/mod/quiz/classes/external.php#L364

I guess you want 'all' attempts, but the default is to only return 'finished' ones.
In reply to Tim Hunt

Trả lời: Re: mod_quiz_get_user_attempts returns empty array

by Xuan Dac -
Currently I am making an application that uses Moodle webservice. But I'm having a hard time getting the list of questions in a quiz. Can you explain to me how to get the questions in a quiz.