Skip to content

Commit

Permalink
solve issue with paths not requested
Browse files Browse the repository at this point in the history
 ... 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
  • Loading branch information
Don-Isdale committed May 21, 2021
1 parent 56ffd65 commit 126a15a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
30 changes: 29 additions & 1 deletion frontend/app/components/service/api-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { breakPoint } from '../../utils/breakPoint';

/*----------------------------------------------------------------------------*/

const dLog = console.debug;

/*----------------------------------------------------------------------------*/

/* d3.schemeDark2
*/
let apiServers_colour_scale =
Expand Down Expand Up @@ -41,6 +45,7 @@ export default EmberObject.extend({
dataset: service('data/dataset'),
block: service('data/block'),
apiServers: service(),
queryParamsService: service('query-params'),


init() {
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
}
}
});

Expand All @@ -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() {
Expand Down
10 changes: 8 additions & 2 deletions frontend/app/models/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}),

Expand Down
4 changes: 4 additions & 0 deletions frontend/app/services/data/flows-collate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 126a15a

Please sign in to comment.