original_string: public function checkRoundsFor(\Gems_Tracker_RespondentTrack $respTrack, $userId, \Gems_Task_TaskRunnerBatch $batch = null)
      {
          if (null === $batch) {
              $batch = new \Gems_Task_TaskRunnerBatch('tmp-tack-' . $respTrack->getRespondentTrackId());
          }
          // Step one: update existing tokens
          $i = $batch->addToCounter('roundChangeUpdates', $this->checkExistingRoundsFor($respTrack, $userId));
          $batch->setMessage('roundChangeUpdates', sprintf($this->_('Round changes propagated to %d tokens.'), $i));
  
          // Step two: deactivate inactive rounds
          $i = $batch->addToCounter('deletedTokens', $this->removeInactiveRounds($respTrack, $userId));
          $batch->setMessage('deletedTokens', sprintf($this->_('%d tokens deleted by round changes.'), $i));
  
          // Step three: create lacking tokens
          $i = $batch->addToCounter('createdTokens', $this->addNewTokens($respTrack, $userId));
          $batch->setMessage('createdTokens', sprintf($this->_('%d tokens created to by round changes.'), $i));
  
          // Step four: set the dates and times
          //$changed = $this->checkTokensFromStart($respTrack, $userId);
          $changed = $respTrack->checkTrackTokens($userId);
          $ica = $batch->addToCounter('tokenDateCauses', $changed ? 1 : 0);
          $ich = $batch->addToCounter('tokenDateChanges', $changed);
          $batch->setMessage('tokenDateChanges', sprintf($this->_('%2$d token date changes in %1$d tracks.'), $ica, $ich));
  
          $i = $batch->addToCounter('checkedRespondentTracks');
          $batch->setMessage('checkedRespondentTracks', sprintf($this->_('Checked %d tracks.'), $i));
      }
code: public function checkRoundsFor(\Gems_Tracker_RespondentTrack $respTrack, $userId, \Gems_Task_TaskRunnerBatch $batch = null)
      {
          if (null === $batch) {
              $batch = new \Gems_Task_TaskRunnerBatch('tmp-tack-' . $respTrack->getRespondentTrackId());
          }
          // Step one: update existing tokens
          $i = $batch->addToCounter('roundChangeUpdates', $this->checkExistingRoundsFor($respTrack, $userId));
          $batch->setMessage('roundChangeUpdates', sprintf($this->_('Round changes propagated to %d tokens.'), $i));
  
          // Step two: deactivate inactive rounds
          $i = $batch->addToCounter('deletedTokens', $this->removeInactiveRounds($respTrack, $userId));
          $batch->setMessage('deletedTokens', sprintf($this->_('%d tokens deleted by round changes.'), $i));
  
          // Step three: create lacking tokens
          $i = $batch->addToCounter('createdTokens', $this->addNewTokens($respTrack, $userId));
          $batch->setMessage('createdTokens', sprintf($this->_('%d tokens created to by round changes.'), $i));
  
          // Step four: set the dates and times
          //$changed = $this->checkTokensFromStart($respTrack, $userId);
          $changed = $respTrack->checkTrackTokens($userId);
          $ica = $batch->addToCounter('tokenDateCauses', $changed ? 1 : 0);
          $ich = $batch->addToCounter('tokenDateChanges', $changed);
          $batch->setMessage('tokenDateChanges', sprintf($this->_('%2$d token date changes in %1$d tracks.'), $ica, $ich));
  
          $i = $batch->addToCounter('checkedRespondentTracks');
          $batch->setMessage('checkedRespondentTracks', sprintf($this->_('Checked %d tracks.'), $i));
      }
code_tokens: public function checkRoundsFor ( \ Gems_Tracker_RespondentTrack $ respTrack , $ userId , \ Gems_Task_TaskRunnerBatch $ batch = null ) { if ( null === $ batch ) { $ batch = new \ Gems_Task_TaskRunnerBatch ( 'tmp-tack-' . $ respTrack -> getRespondentTrackId ( ) ) ; } // Step one: update existing tokens $ i = $ batch -> addToCounter ( 'roundChangeUpdates' , $ this -> checkExistingRoundsFor ( $ respTrack , $ userId ) ) ; $ batch -> setMessage ( 'roundChangeUpdates' , sprintf ( $ this -> _ ( 'Round changes propagated to %d tokens.' ) , $ i ) ) ; // Step two: deactivate inactive rounds $ i = $ batch -> addToCounter ( 'deletedTokens' , $ this -> removeInactiveRounds ( $ respTrack , $ userId ) ) ; $ batch -> setMessage ( 'deletedTokens' , sprintf ( $ this -> _ ( '%d tokens deleted by round changes.' ) , $ i ) ) ; // Step three: create lacking tokens $ i = $ batch -> addToCounter ( 'createdTokens' , $ this -> addNewTokens ( $ respTrack , $ userId ) ) ; $ batch -> setMessage ( 'createdTokens' , sprintf ( $ this -> _ ( '%d tokens created to by round changes.' ) , $ i ) ) ; // Step four: set the dates and times //$changed = $this->checkTokensFromStart($respTrack, $userId); $ changed = $ respTrack -> checkTrackTokens ( $ userId ) ; $ ica = $ batch -> addToCounter ( 'tokenDateCauses' , $ changed ? 1 : 0 ) ; $ ich = $ batch -> addToCounter ( 'tokenDateChanges' , $ changed ) ; $ batch -> setMessage ( 'tokenDateChanges' , sprintf ( $ this -> _ ( '%2$d token date changes in %1$d tracks.' ) , $ ica , $ ich ) ) ; $ i = $ batch -> addToCounter ( 'checkedRespondentTracks' ) ; $ batch -> setMessage ( 'checkedRespondentTracks' , sprintf ( $ this -> _ ( 'Checked %d tracks.' ) , $ i ) ) ; }
docstring: Check for the existence of all tokens and create them otherwise
  
  @param \Gems_Tracker_RespondentTrack $respTrack The respondent track to check
  @param int $userId Id of the user who takes the action (for logging)
  @param \Gems_Task_TaskRunnerBatch $changes batch for counters
docstring_tokens: Check for the existence of all tokens and create them otherwise