Skip to content
Snippets Groups Projects
Commit 0cfb7489 authored by Alex Barth's avatar Alex Barth
Browse files

Quick fix to progress reporting for deleting items. Will need more love.

parent 007b44a8
No related branches found
No related tags found
No related merge requests found
......@@ -88,7 +88,7 @@ class FeedsState {
*/
public function __construct() {
$this->total =
$this->progress = 1;
$this->progress =
$this->created =
$this->updated =
$this->deleted =
......@@ -103,12 +103,24 @@ class FeedsState {
* A float between 0 and 1, 1 = FEEDS_BATCH_COMPLETE.
*/
public function progress() {
// If no total and no progress is reported, we are done.
if (empty($this->total) && empty($this->progress)) {
return FEEDS_BATCH_COMPLETE;
}
$progress = $this->progress / $this->total;
if ($progress == FEEDS_BATCH_COMPLETE && $this->total != $this->progress) {
return 0.999;
}
return $progress;
}
/**
* Sets this state to finished.
*/
public function finished() {
$this->total =
$this->progress = FEEDS_BATCH_COMPLETE;
}
}
/**
......@@ -282,7 +294,8 @@ class FeedsSource extends FeedsConfigurable {
}
// Fetching envelops parsing.
$parser_progress = $parser->progress() / $fetcher->total;
return $fetcher->progress - 1.0 + $parser_progress;
$fetcher_fraction = 1.0 / $fetcher->total;
return $fetcher->progress() - $fetcher_fraction + $parser_progress;
}
/**
......
......@@ -99,7 +99,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
else {
drupal_set_message(t('There is no content to be deleted.'));
}
$state->progress = FEEDS_BATCH_COMPLETE;
$state->finished();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment