Fix evaluated filter for progress bar being saved
This commit is contained in:
parent
f189c4384e
commit
075dd78610
@ -113,8 +113,7 @@ export class PageBlockProgress extends PageBlock {
|
|||||||
/**
|
/**
|
||||||
* Helper function to fetch and parse reporter's reports.
|
* Helper function to fetch and parse reporter's reports.
|
||||||
*/
|
*/
|
||||||
fetch (options: Options, api: ComposeAPI, namespaceID: string): Promise<object> {
|
fetch (additionalOptions: Options, api: ComposeAPI, namespaceID: string): Promise<object> {
|
||||||
options = _.merge(this.options, options)
|
|
||||||
const reports = []
|
const reports = []
|
||||||
const dimensions = dimensionFunctions.convert({ modifier: 'YEAR', field: 'createdAt' })
|
const dimensions = dimensionFunctions.convert({ modifier: 'YEAR', field: 'createdAt' })
|
||||||
|
|
||||||
@ -123,42 +122,42 @@ export class PageBlockProgress extends PageBlock {
|
|||||||
// Construct value report
|
// Construct value report
|
||||||
const { field: valueField, operation: valueOperation = '' } = this.options.value
|
const { field: valueField, operation: valueOperation = '' } = this.options.value
|
||||||
|
|
||||||
if (options.value.moduleID && valueField) {
|
if (this.options.value.moduleID && valueField) {
|
||||||
if (valueOperation && valueField !== 'count') {
|
if (valueOperation && valueField !== 'count') {
|
||||||
metrics = `${valueOperation}(${valueField}) AS rp`
|
metrics = `${valueOperation}(${valueField}) AS rp`
|
||||||
}
|
}
|
||||||
|
|
||||||
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...options.value }))
|
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...this.options.value, ...additionalOptions.value }))
|
||||||
} else {
|
} else {
|
||||||
reports.push(new Promise(resolve => resolve(options.value.default)))
|
reports.push(new Promise(resolve => resolve(this.options.value.default)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct minValue report
|
// Construct minValue report
|
||||||
const { field: minValueField, operation: minValueOperation = '' } = this.options.minValue
|
const { field: minValueField, operation: minValueOperation = '' } = this.options.minValue
|
||||||
|
|
||||||
if (options.minValue.moduleID && minValueField) {
|
if (this.options.minValue.moduleID && minValueField) {
|
||||||
metrics = ''
|
metrics = ''
|
||||||
if (minValueOperation && minValueField !== 'count') {
|
if (minValueOperation && minValueField !== 'count') {
|
||||||
metrics = `${minValueOperation}(${minValueField}) AS rp`
|
metrics = `${minValueOperation}(${minValueField}) AS rp`
|
||||||
}
|
}
|
||||||
|
|
||||||
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...options.minValue }))
|
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...this.options.minValue, ...additionalOptions.minValue }))
|
||||||
} else {
|
} else {
|
||||||
reports.push(new Promise(resolve => resolve(options.minValue.default)))
|
reports.push(new Promise(resolve => resolve(this.options.minValue.default)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct minValue report
|
// Construct minValue report
|
||||||
const { field: maxValueField, operation: maxValueOperation = '' } = this.options.maxValue
|
const { field: maxValueField, operation: maxValueOperation = '' } = this.options.maxValue
|
||||||
|
|
||||||
if (options.maxValue.moduleID && maxValueField) {
|
if (this.options.maxValue.moduleID && maxValueField) {
|
||||||
metrics = ''
|
metrics = ''
|
||||||
if (maxValueOperation && maxValueField !== 'count') {
|
if (maxValueOperation && maxValueField !== 'count') {
|
||||||
metrics = `${maxValueOperation}(${maxValueField}) AS rp`
|
metrics = `${maxValueOperation}(${maxValueField}) AS rp`
|
||||||
}
|
}
|
||||||
|
|
||||||
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...options.maxValue }))
|
reports.push(api.recordReport({ namespaceID, metrics, dimensions, ...this.options.maxValue, ...additionalOptions.maxValue }))
|
||||||
} else {
|
} else {
|
||||||
reports.push(new Promise(resolve => resolve(options.maxValue.default)))
|
reports.push(new Promise(resolve => resolve(this.options.maxValue.default)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(reports).then(([value, min, max]: Array<any>) => {
|
return Promise.all(reports).then(([value, min, max]: Array<any>) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user