From 126a15ad11384bf5adfdbd7326f79fffe6436f04 Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 21 May 2021 18:10:19 +1000 Subject: [PATCH] solve issue with paths not requested ... caused by no block-adj because block.showPaths was false. request feature count for all blocks on secondary, and use count from blockFeatureLimits in block.showPaths. api-server.js : add featuresCountAllTaskInstance() and use after datasetsTask in getDatasets(). block.js : showPaths() : also use .featureValueCount, which is available from blockFeatureLimits flows-collate.js : blockAdjIds() : add comment. this is a sub-item in #234 --- frontend/app/components/service/api-server.js | 30 ++++++++++++++++++- frontend/app/models/block.js | 10 +++++-- frontend/app/services/data/flows-collate.js | 4 +++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/service/api-server.js b/frontend/app/components/service/api-server.js index e50dbbf26..5d0daf576 100644 --- a/frontend/app/components/service/api-server.js +++ b/frontend/app/components/service/api-server.js @@ -8,6 +8,10 @@ import { breakPoint } from '../../utils/breakPoint'; /*----------------------------------------------------------------------------*/ +const dLog = console.debug; + +/*----------------------------------------------------------------------------*/ + /* d3.schemeDark2 */ let apiServers_colour_scale = @@ -41,6 +45,7 @@ export default EmberObject.extend({ dataset: service('data/dataset'), block: service('data/block'), apiServers: service(), + queryParamsService: service('query-params'), init() { @@ -126,7 +131,7 @@ export default EmberObject.extend({ if (serverSo !== server) breakPoint('getDatasets', serverSo, server); - datasetsTask.then(function (blockValues) { + datasetsTask.then((blockValues) => { console.log(datasetsHandle, 'datasetsTask then', blockValues); if (datasetsHandle) { @@ -139,6 +144,11 @@ export default EmberObject.extend({ // me.sendAction('receivedDatasets', datasetsHandle, blockValues); // or via .evented() on task apiServers.trigger('receivedDatasets', blockValues); + // mapview : model() has already done getBlocksLimits() for primaryServer + if (this.get('apiServers.primaryServer') !== this) { + let ti = this.get('featuresCountAllTaskInstance'); + dLog('getDatasets', 'evaluated featuresCountAllTaskInstance', ti); + } } }); @@ -149,6 +159,24 @@ export default EmberObject.extend({ // .drop() , + + /** Request block.featuresCount for all blocks. + */ + featuresCountAllTaskInstance : computed('name', function () { + dLog('featuresCountAllTaskInstance', this.name, this); + let params = this.get('queryParamsService').get('params'); + // copied from routes/mapview.js:model() + let allInitially = params.parsedOptions && params.parsedOptions.allInitially; + const blockService = this.get('block'); + // (allInitially ? '' : 'Summary') + let getBlocksTask = blockService.get('getBlocksLimits'); + + /** Task Instance. param blockIds is [] */ + let getBlocksTI = getBlocksTask.apply(blockService, [[]]); + + return getBlocksTI; + }), + blocksByReferenceAndScope : computed( 'datasetsBlocks.[]', function() { diff --git a/frontend/app/models/block.js b/frontend/app/models/block.js index 8e33e1cfd..2ab12c292 100644 --- a/frontend/app/models/block.js +++ b/frontend/app/models/block.js @@ -164,9 +164,15 @@ export default Model.extend({ * applicable. It is tagged HighDensity, but we should add a * separate tag to indicate the lack of a feature name. * So disable paths if tagged HighDensity. + * + * this expression uses the fact that (undefined < 5e4) is false. + * .featureValueCount is approx 2 * .featuresCount because it sums feature.value.length which is often 2. */ - paths &&= ! this.get('isHighDensity') && (this.get('featuresCountIncludingZoom') < 5e4); - // dLog('showPaths', dataset, paths); + paths &&= ! this.get('isHighDensity') && ( + (this.get('featuresCount') < 5e4) || + (this.get('featureValueCount') < 5e4 * 2) || + (this.get('featuresCountIncludingZoom') < 5e4)); + // dLog('showPaths', dataset, paths); return paths; }), diff --git a/frontend/app/services/data/flows-collate.js b/frontend/app/services/data/flows-collate.js index 36e788d1f..2b2d37a2d 100644 --- a/frontend/app/services/data/flows-collate.js +++ b/frontend/app/services/data/flows-collate.js @@ -247,6 +247,10 @@ export default Service.extend({ * The values b0, b1 are block IDs. */ blockAdjIds : computed('block.viewedForPaths.[]', 'adjAxesArr.[]', function () { + /** adjAxesArr.[] probably provides the same update information as stacksCount.count. + 'oa.stacks.stacksCount.count', + */ + /** this could be used as the basis for adjAxes */ let blockForPaths = this.get('blockForPaths'); let axesP = this.get('oa.axesP');