original_string: public function recalcTrackFields($batchId, $cond = null)
      {
          $respTrackSelect = $this->db->select();
          $respTrackSelect->from('gems__respondent2track', array('gr2t_id_respondent_track'));
          $respTrackSelect->join('gems__reception_codes', 'gr2t_reception_code = grc_id_reception_code', array());
          $respTrackSelect->join('gems__tracks', 'gr2t_id_track = gtr_id_track', array());
  
          if ($cond) {
              $respTrackSelect->where($cond);
          }
          $respTrackSelect->where('gr2t_active = 1');
          $respTrackSelect->where('grc_success = 1');
          $respTrackSelect->where('gtr_active = 1');
          // Also recaclulate when track was completed: there may be new rounds!
          // $respTrackSelect->where('gr2t_count != gr2t_completed');
  
          $batch = $this->loader->getTaskRunnerBatch($batchId);
          //Now set the step duration
          $batch->minimalStepDurationMs = 3000;
  
          if (! $batch->isLoaded()) {
              $statement = $respTrackSelect->query();
              //Process one item at a time to prevent out of memory errors for really big resultsets
              while ($respTrackData  = $statement->fetch()) {
                  $respTrackId = $respTrackData['gr2t_id_respondent_track'];
                  $batch->setTask('Tracker_RecalculateFields', 'trkfcalc-' . $respTrackId, $respTrackId);
                  $batch->addToCounter('resptracks');
              }
          }
  
          return $batch;
      }
code: public function recalcTrackFields($batchId, $cond = null)
      {
          $respTrackSelect = $this->db->select();
          $respTrackSelect->from('gems__respondent2track', array('gr2t_id_respondent_track'));
          $respTrackSelect->join('gems__reception_codes', 'gr2t_reception_code = grc_id_reception_code', array());
          $respTrackSelect->join('gems__tracks', 'gr2t_id_track = gtr_id_track', array());
  
          if ($cond) {
              $respTrackSelect->where($cond);
          }
          $respTrackSelect->where('gr2t_active = 1');
          $respTrackSelect->where('grc_success = 1');
          $respTrackSelect->where('gtr_active = 1');
          // Also recaclulate when track was completed: there may be new rounds!
          // $respTrackSelect->where('gr2t_count != gr2t_completed');
  
          $batch = $this->loader->getTaskRunnerBatch($batchId);
          //Now set the step duration
          $batch->minimalStepDurationMs = 3000;
  
          if (! $batch->isLoaded()) {
              $statement = $respTrackSelect->query();
              //Process one item at a time to prevent out of memory errors for really big resultsets
              while ($respTrackData  = $statement->fetch()) {
                  $respTrackId = $respTrackData['gr2t_id_respondent_track'];
                  $batch->setTask('Tracker_RecalculateFields', 'trkfcalc-' . $respTrackId, $respTrackId);
                  $batch->addToCounter('resptracks');
              }
          }
  
          return $batch;
      }
code_tokens: public function recalcTrackFields ( $ batchId , $ cond = null ) { $ respTrackSelect = $ this -> db -> select ( ) ; $ respTrackSelect -> from ( 'gems__respondent2track' , array ( 'gr2t_id_respondent_track' ) ) ; $ respTrackSelect -> join ( 'gems__reception_codes' , 'gr2t_reception_code = grc_id_reception_code' , array ( ) ) ; $ respTrackSelect -> join ( 'gems__tracks' , 'gr2t_id_track = gtr_id_track' , array ( ) ) ; if ( $ cond ) { $ respTrackSelect -> where ( $ cond ) ; } $ respTrackSelect -> where ( 'gr2t_active = 1' ) ; $ respTrackSelect -> where ( 'grc_success = 1' ) ; $ respTrackSelect -> where ( 'gtr_active = 1' ) ; // Also recaclulate when track was completed: there may be new rounds! // $respTrackSelect->where('gr2t_count != gr2t_completed'); $ batch = $ this -> loader -> getTaskRunnerBatch ( $ batchId ) ; //Now set the step duration $ batch -> minimalStepDurationMs = 3000 ; if ( ! $ batch -> isLoaded ( ) ) { $ statement = $ respTrackSelect -> query ( ) ; //Process one item at a time to prevent out of memory errors for really big resultsets while ( $ respTrackData = $ statement -> fetch ( ) ) { $ respTrackId = $ respTrackData [ 'gr2t_id_respondent_track' ] ; $ batch -> setTask ( 'Tracker_RecalculateFields' , 'trkfcalc-' . $ respTrackId , $ respTrackId ) ; $ batch -> addToCounter ( 'resptracks' ) ; } } return $ batch ; }
docstring: Recalculates the fields in tracks.
  
  Does recalculate changed tracks
  
  @param string $batchId A unique identifier for the current batch
  @param string $cond Optional where statement for selecting tracks
  @return \Gems_Task_TaskRunnerBatch A batch to process the changes
docstring_tokens: Recalculates the fields in tracks .