@dative-gpi/foundation-core-services 1.0.192 → 1.0.193-value-data-composable
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,15 +6,14 @@ import { getManyDatas } from "@dative-gpi/foundation-core-services/composables";
|
|
|
6
6
|
|
|
7
7
|
import { RootMode } from "@dative-gpi/foundation-shared-domain/enums";
|
|
8
8
|
|
|
9
|
-
import type { DataFiltersDTO, DataLeafDTO,
|
|
9
|
+
import type { DataFiltersDTO, DataLeafDTO, AggregateValueFilter } from "@dative-gpi/foundation-core-domain/models";
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const useAggregateValue = () => {
|
|
12
12
|
const fetching = ref(false);
|
|
13
13
|
const error = ref<string | null>(null);
|
|
14
|
-
const
|
|
15
|
-
const rawObservedValue = ref<number | null>(null);
|
|
14
|
+
const value = ref<number | null>(null);
|
|
16
15
|
|
|
17
|
-
const fetch = async (filter:
|
|
16
|
+
const fetch = async (filter: AggregateValueFilter) => {
|
|
18
17
|
fetching.value = true;
|
|
19
18
|
|
|
20
19
|
const leaf = {
|
|
@@ -48,36 +47,23 @@ export const useAbsoluteProfitsComparison = () => {
|
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
error.value = null;
|
|
51
|
-
|
|
52
|
-
rawObservedValue.value = null;
|
|
50
|
+
value.value = null;
|
|
53
51
|
|
|
54
52
|
try {
|
|
55
|
-
const
|
|
56
|
-
startDate: filter.
|
|
57
|
-
endDate: filter.
|
|
53
|
+
const periodFilters: DataFiltersDTO = {
|
|
54
|
+
startDate: filter.start,
|
|
55
|
+
endDate: filter.end,
|
|
58
56
|
timeOffset: filter.timeOffset,
|
|
59
57
|
dateVariables: [],
|
|
60
58
|
mode: RootMode.Leaf,
|
|
61
59
|
leaf: { ...leaf, correlationId: uuidv4() } as DataLeafDTO
|
|
62
60
|
};
|
|
63
61
|
|
|
64
|
-
const
|
|
65
|
-
startDate: filter.observedPeriodStart,
|
|
66
|
-
endDate: filter.observedPeriodEnd,
|
|
67
|
-
timeOffset: filter.timeOffset,
|
|
68
|
-
dateVariables: [],
|
|
69
|
-
mode: RootMode.Leaf,
|
|
70
|
-
leaf: { ...leaf, correlationId: uuidv4() } as DataLeafDTO
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const dataSerieReference = await getManyDatas(refFilters);
|
|
74
|
-
const dataSerieObserved = await getManyDatas(actFilters);
|
|
62
|
+
const dataSerie = await getManyDatas(periodFilters);
|
|
75
63
|
|
|
76
|
-
const
|
|
77
|
-
const rawObs = dataSerieObserved?.[0]?.datas?.[0]?.values?.[0];
|
|
64
|
+
const dataSerieValue = dataSerie?.[0]?.datas?.[0]?.values?.[0];
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
rawObservedValue.value = rawObs == null ? null : Number(rawObs);
|
|
66
|
+
value.value = dataSerieValue == null ? null : Number(dataSerieValue);
|
|
81
67
|
|
|
82
68
|
} catch (exception: any) {
|
|
83
69
|
error.value = exception.response?.data ?? exception.message;
|
|
@@ -89,8 +75,7 @@ export const useAbsoluteProfitsComparison = () => {
|
|
|
89
75
|
return {
|
|
90
76
|
fetching,
|
|
91
77
|
error,
|
|
92
|
-
|
|
93
|
-
rawObservedValue,
|
|
78
|
+
value,
|
|
94
79
|
fetch,
|
|
95
80
|
};
|
|
96
81
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
|
|
5
5
|
},
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.193-value-data-composable",
|
|
8
8
|
"description": "",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dative-gpi/foundation-core-domain": "1.0.
|
|
16
|
+
"@dative-gpi/foundation-core-domain": "1.0.193-value-data-composable"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"vue": "^3.4.38",
|
|
22
22
|
"vue-router": "^4.3.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "e6d7d1fd7a3bc060cebb335596f4d95a6ce91356"
|
|
25
25
|
}
|