Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #32 from fielded/no-zone-allocations-and-plans
Browse files Browse the repository at this point in the history
fix: not working if zone stock counts have no version
  • Loading branch information
patriciagarcia authored Oct 4, 2016
2 parents 1d7de72 + 9309da6 commit 9aacf1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@
var location = getLocation(lgas, states, zones, stockCount);
var locationThresholds = void 0;
if (location && location.level === 'zone') {
locationThresholds = _this2.thresholdsService.calculateThresholds(location, stockCount, products, requiredAllocations[location._id]);
// Temporary fix for https://github.com/fielded/nav-integrated-national-dashboard/issues/265
// This should be removed when https://github.com/fielded/nav-etl/issues/136 is fixed
locationThresholds = _this2.thresholdsService.calculateThresholds(location, stockCount, products, requiredAllocations[location._id], { version: 'last' });
} else {
locationThresholds = _this2.thresholdsService.calculateThresholds(location, stockCount, products);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/state-indicators.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class StateIndicatorsService {
const location = getLocation(lgas, states, zones, stockCount)
let locationThresholds
if (location && location.level === 'zone') {
locationThresholds = this.thresholdsService.calculateThresholds(location, stockCount, products, requiredAllocations[location._id])
// Temporary fix for https://github.com/fielded/nav-integrated-national-dashboard/issues/265
// This should be removed when https://github.com/fielded/nav-etl/issues/136 is fixed
locationThresholds = this.thresholdsService.calculateThresholds(location, stockCount, products, requiredAllocations[location._id], { version: 'last' })
} else {
locationThresholds = this.thresholdsService.calculateThresholds(location, stockCount, products)
}
Expand Down
4 changes: 2 additions & 2 deletions test/state-indicators.service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ describe('state indicators service', function () {
stateIndicatorsService.decorateWithIndicators(stockCounts)
.then(function (decoratedStockCounts) {
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(states[0], stockCounts[0], products)
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(zones[0], stockCounts[1], products, requiredByState)
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(zones[0], stockCounts[1], products, requiredByState, { version: 'last' })
expect(decoratedStockCounts).toEqual(expected)
})
$rootScope.$digest()
Expand Down Expand Up @@ -427,7 +427,7 @@ describe('state indicators service', function () {
stateIndicatorsService.decorateWithIndicators(stockCounts)
.then(function (decoratedStockCounts) {
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(states[0], stockCounts[0], products)
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(zones[0], stockCounts[1], products, undefined)
expect(thresholdsService.calculateThresholds).toHaveBeenCalledWith(zones[0], stockCounts[1], products, undefined, { version: 'last' })
expect(decoratedStockCounts).toEqual(expected)
})
$rootScope.$digest()
Expand Down

0 comments on commit 9aacf1e

Please sign in to comment.