Address missing job events.

- Fix off by one error.
- Add unit tests for Stream Service.
This commit is contained in:
kialam
2018-11-30 11:23:15 -05:00
parent abc74fc9b8
commit 746a154f2b
3 changed files with 104 additions and 3 deletions

View File

@@ -50,6 +50,10 @@ function OutputStream ($q) {
this.calcFactors = size => {
const factors = [1];
if (size !== parseInt(size, 10) || size <= 1) {
return factors;
}
for (let i = 2; i <= size / 2; i++) {
if (size % i === 0) {
factors.push(i);
@@ -135,7 +139,7 @@ function OutputStream ($q) {
this.isReadyToRender = () => {
const { total } = this.counters;
const readyCount = this.counters.ready - this.counters.min;
const readyCount = this.getReadyCount();
if (readyCount <= 0) {
return false;
@@ -202,7 +206,7 @@ function OutputStream ($q) {
return $q.resolve();
}
const readyCount = this.counters.ready - this.counters.min;
const readyCount = this.getReadyCount();
let events = [];
if (readyCount > 0) {
@@ -230,6 +234,7 @@ function OutputStream ($q) {
});
this.getMaxCounter = () => this.counters.max;
this.getReadyCount = () => this.counters.ready - this.counters.min + 1;
}
OutputStream.$inject = ['$q'];