## General developer forum

### Cant get_last_step is always default step

Re: Cant get_last_step is always default step

It's not supposed to work like that.

Have a look at some of the standard Moodle question types.

(Sorry, not the most helpful response, but I have had a long day.)

Average of ratings: -
Re: Cant get_last_step is always default step

Then how does it work? I looked it up in different plugins and the way to get the responses of a student seems to be qa->get_last_qt_var($fieldname). But it doesn't work for me. I never get any data. Even when i just copy-pasted the short answer code into my plugin i won't work. Is there a method I need to implement in my question.php or questiontype.php in order to get the get_last_qt_var() working? Average of ratings: - Re: Cant get_last_step is always default step It is a good idea to use this query https://docs.moodle.org/dev/Overview_of_the_Moodle_question_engine#Detailed_data_about_an_attempt to see what is happening as your question is attempted. The most likely method you might have missed is get_expected_data in the question class. Average of ratings: - Re: Cant get_last_step is always default step Thank you for your reply. I did implement get_expected_data and also summarise_response/get_correct_response/is_complete_response. But I'm not completely sure how to implement get_expected_data right. Right now I only return an array of fields I want to use to grade the response. But in my renderer.php there is also another field that is just for display purpose. Should I add that too? I'm extending the question_graded_automatically question type. When i look at the http-request I can also see that my form-data is transmitted. Also when I print out the$response parameter from the methods mentioned above it looks like it is completely empty.

When I look at the database there is only a entry in the mdl_question_attempt_step_data when I submit the correct response.

Average of ratings: -
Re: Cant get_last_step is always default step

I found my mistake. You were completely right. I forgot the return statement in get_expected_data. Never wasted more time in my life as I did searching for this mistake.

Average of ratings: -