original_string: protected function find_steps_with_submitted_response() {
          $stepnos = array();
          $lastsavedstep = null;
          foreach ($this->qa->get_step_iterator() as $stepno => $step) {
              if ($this->qa->get_behaviour()->step_has_a_submitted_response($step)) {
                  $stepnos[] = $stepno;
                  $lastsavedstep = null;
              } else {
                  $qtdata = $step->get_qt_data();
                  if (count($qtdata)) {
                      $lastsavedstep = $stepno;
                  }
              }
          }
  
          if (!is_null($lastsavedstep)) {
              $stepnos[] = $lastsavedstep;
          }
          if (empty($stepnos)) {
              $this->stepswithsubmittedresponses = array();
          } else {
              // Re-index array so index starts with 1.
              $this->stepswithsubmittedresponses = array_combine(range(1, count($stepnos)), $stepnos);
          }
      }
code: protected function find_steps_with_submitted_response() {
          $stepnos = array();
          $lastsavedstep = null;
          foreach ($this->qa->get_step_iterator() as $stepno => $step) {
              if ($this->qa->get_behaviour()->step_has_a_submitted_response($step)) {
                  $stepnos[] = $stepno;
                  $lastsavedstep = null;
              } else {
                  $qtdata = $step->get_qt_data();
                  if (count($qtdata)) {
                      $lastsavedstep = $stepno;
                  }
              }
          }
  
          if (!is_null($lastsavedstep)) {
              $stepnos[] = $lastsavedstep;
          }
          if (empty($stepnos)) {
              $this->stepswithsubmittedresponses = array();
          } else {
              // Re-index array so index starts with 1.
              $this->stepswithsubmittedresponses = array_combine(range(1, count($stepnos)), $stepnos);
          }
      }
code_tokens: protected function find_steps_with_submitted_response ( ) { $ stepnos = array ( ) ; $ lastsavedstep = null ; foreach ( $ this -> qa -> get_step_iterator ( ) as $ stepno => $ step ) { if ( $ this -> qa -> get_behaviour ( ) -> step_has_a_submitted_response ( $ step ) ) { $ stepnos [ ] = $ stepno ; $ lastsavedstep = null ; } else { $ qtdata = $ step -> get_qt_data ( ) ; if ( count ( $ qtdata ) ) { $ lastsavedstep = $ stepno ; } } } if ( ! is_null ( $ lastsavedstep ) ) { $ stepnos [ ] = $ lastsavedstep ; } if ( empty ( $ stepnos ) ) { $ this -> stepswithsubmittedresponses = array ( ) ; } else { // Re-index array so index starts with 1. $ this -> stepswithsubmittedresponses = array_combine ( range ( 1 , count ( $ stepnos ) ) , $ stepnos ) ; } }
docstring: Find the step nos  in which a student has submitted a response. Including any step with a response that is saved before
  the question attempt finishes.
  
  Called from constructor, should not be called from elsewhere.
docstring_tokens: Find the step nos in which a student has submitted a response . Including any step with a response that is saved before the question attempt finishes .