mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 05:03:10 +00:00
* fixes App Analytics summary not adjusting to the datetime [UI] #10571 * added comments to the code * updated sum logic, used sumBy method from lodash * addressing comment
This commit is contained in:
parent
6568d0df08
commit
751919e6ca
@ -26,6 +26,7 @@ import {
|
|||||||
omit,
|
omit,
|
||||||
round,
|
round,
|
||||||
sortBy,
|
sortBy,
|
||||||
|
sumBy,
|
||||||
toNumber,
|
toNumber,
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@ -580,29 +581,32 @@ export const getEntitiesChartSummary = (
|
|||||||
export const getWebChartSummary = (
|
export const getWebChartSummary = (
|
||||||
chartResults: (DataInsightChartResult | undefined)[]
|
chartResults: (DataInsightChartResult | undefined)[]
|
||||||
) => {
|
) => {
|
||||||
const updatedSummary = WEB_SUMMARY_LIST.map((summary) => {
|
const updatedSummary = [];
|
||||||
|
|
||||||
|
for (const summary of WEB_SUMMARY_LIST) {
|
||||||
// grab the current chart type
|
// grab the current chart type
|
||||||
const chartData = chartResults.find(
|
const chartData = chartResults.find(
|
||||||
(chart) => chart?.chartType === summary.id
|
(chart) => chart?.chartType === summary.id
|
||||||
);
|
);
|
||||||
// return default summary if chart data is undefined else calculate the latest count for chartType
|
// return default summary if chart data is undefined else calculate the latest count for chartType
|
||||||
if (isUndefined(chartData)) {
|
if (isUndefined(chartData)) {
|
||||||
return summary;
|
updatedSummary.push(summary);
|
||||||
} else {
|
|
||||||
if (chartData.chartType === DataInsightChartType.DailyActiveUsers) {
|
|
||||||
const latestData = last(chartData.data);
|
|
||||||
|
|
||||||
return { ...summary, latest: latestData?.activeUsers ?? 0 };
|
continue;
|
||||||
} else {
|
}
|
||||||
const { total } = getGraphDataByEntityType(
|
|
||||||
chartData.data ?? [],
|
|
||||||
chartData.chartType
|
|
||||||
);
|
|
||||||
|
|
||||||
return { ...summary, latest: total };
|
const { chartType, data } = chartData;
|
||||||
}
|
|
||||||
}
|
updatedSummary.push({
|
||||||
|
...summary,
|
||||||
|
latest: sumBy(
|
||||||
|
data,
|
||||||
|
chartType === DataInsightChartType.DailyActiveUsers
|
||||||
|
? 'activeUsers'
|
||||||
|
: 'pageViews'
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return updatedSummary;
|
return updatedSummary;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user