what does get_num_steps mean?
Thanks in advance
Hi Adilet. I want to offer a friendly piece of advice that might be helpful... It would be better to provide some context and additional details about your question, such as, what are you trying to do?
I was able to find the function you asked about in my Moodle source code...
grep -r 'function get_num_steps' moodle_code_directory
Using that, I discovered this:
./question/engine/questionattempt.php: public function get_num_steps() {
So that function is part of the question module. In looking at that function in the questionattempt.php file, I see:
/**
* Get the number of steps in this attempt.
* For internal/test code use only.
* @return int the number of steps we currently have.
*/
public function get_num_steps() {
return count($this->steps);
}
It says it is for internal/test code use only, but it is called/used throughout the question engine:
question/behaviour/missing/tests/missingbehaviour_test.php: $this->assertEquals(2, $qa->get_num_steps());
question/engine/questionattempt.php: $numrealsteps = $this->get_num_steps();
question/engine/questionattempt.php: public function get_num_steps() {
question/engine/questionattempt.php: if ($this->get_num_steps() == 1 && $this->get_state() == question_state::$complete) {
question/engine/questionattempt.php: if ($this->get_num_steps() > 0) {
question/engine/questionattempt.php: if ($lastseq < 0 || $lastseq >= $this->baseqa->get_num_steps()) {
question/engine/questionattempt.php: return $i >= 0 && $i < $this->qa->get_num_steps();
question/engine/questionattempt.php: $this->i = $this->qa->get_num_steps() - 1;
question/engine/renderer.php: if ($stepno == $qa->get_num_steps()) {
question/engine/tests/helpers.php: return $this->get_question_attempt()->get_num_steps();
question/engine/tests/questionattempt_db_test.php: $this->assertEquals(6, $qa->get_num_steps());
question/engine/tests/questionattempt_db_test.php: $this->assertEquals(1, $qa->get_num_steps());
question/engine/tests/questionattempt_db_test.php: $this->assertEquals(4, $qa->get_num_steps());
question/engine/tests/questionattempt_db_test.php: $this->assertEquals(3, $qa->get_num_steps());
question/engine/tests/questionattempt_with_steps_test.php: public function test_get_num_steps() {
question/engine/tests/questionattempt_with_steps_test.php: $this->assertEquals(3, $this->qa->get_num_steps());
question/engine/tests/questionusagebyactivity_data_test.php: $this->assertEquals(3, $qa->get_num_steps());
question/engine/tests/questionusagebyactivity_data_test.php: $this->assertEquals(0, $qa->get_num_steps());
question/engine/tests/unitofwork_test.php: $this->assertEquals($updatedattempt->get_num_steps(), count($updatedsteps));
question/engine/tests/unitofwork_test.php: $this->assertEquals($updatedattempt->get_num_steps(), count($updatedsteps));
question/engine/tests/unitofwork_test.php: $this->assertEquals($updatedattempt->get_num_steps(), count($updatedsteps));
It would seem that this function is what is used to track/determine the number of steps in an individual question. The class that implements the get_num_steps method has this documentation:
* Tracks an attempt at one particular question in a {@link question_usage_by_activity}.
*
* Most calling code should need to access objects of this class. They should be
* able to do everything through the usage interface. This class is an internal
* implementation detail of the question engine.
*
* Instances of this class correspond to rows in the question_attempts table, and
* a collection of {@link question_attempt_steps}. Question inteaction models and
* question types do work with question_attempt objects
I hope that gets you started.
Jamie
Thanks a lot, Jamie!!!
I'm trying to implement photoficsation during student pass the test.
Only thing is - students don't have to know that the site is making a photos of them.
Hello!
I have one more question related to the photofixation of students within the test.
Where I must make code changes to realize the following functionality: student presses the "next" button to go to the next question and if the next question is a 13th or 26th, the photo of the student must be taken and uploaded?
HELP!!! PLEASE!!!
Wow, Howard provided a pretty good response here: https://moodle.org/mod/forum/discuss.php?d=328587&parent=1321856 It seems like you may want to focus on that thread.
Wow indeed