Skip to content

Commit

Permalink
Merge pull request #1423 from tripal/tv3g4-1422-fix-publish-progress-…
Browse files Browse the repository at this point in the history
…updates

tv3g4 Issue 1422 fix publish update progress
  • Loading branch information
laceysanderson committed Mar 6, 2023
2 parents 31fa47d + 558506c commit 7e728e9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tripal_chado/api/tripal_chado.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function chado_publish_records($values, $job = NULL) {
// Perform the query in chunks.
$sql = $select . $from . $where . ' LIMIT ' . $chunk_size;
$more_records_to_publish = TRUE;
$num_actually_published = 0; // the full number of records published.
$total_records_published = 0;
$i = 0; //reset on each chunk.
while ($more_records_to_publish) {

Expand All @@ -238,9 +238,6 @@ function chado_publish_records($values, $job = NULL) {
// are already in one.
$transaction = db_transaction();
try {
// Keep track of how many we've published so far
// before clearing our chunk,
$num_actually_published = $num_actually_published + $i;
$i = 0;
while ($record = $records->fetchObject()) {

Expand Down Expand Up @@ -286,8 +283,9 @@ function chado_publish_records($values, $job = NULL) {
}

$i++;
$total_records_published++;
if ($report_progress) {
$job->setItemsHandled($i);
$job->setItemsHandled($total_records_published);
}
}
} catch (Exception $e) {
Expand All @@ -308,12 +306,9 @@ function chado_publish_records($values, $job = NULL) {
unset($transaction);
}

// Add the last number published to our total.
$num_actually_published = $num_actually_published + $i;

tripal_report_error($message_type, TRIPAL_INFO,
"Successfully published !count !type record(s).",
['!count' => $num_actually_published, '!type' => $bundle->label], $message_opts);
['!count' => $total_records_published, '!type' => $bundle->label], $message_opts);

return TRUE;
}
Expand Down

0 comments on commit 7e728e9

Please sign in to comment.