Skip to content

Commit e21337f

Browse files
chore: comments
1 parent f427f16 commit e21337f

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/modules/dimensions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// vis: 'dimension' in EventVisualization colums/rows/filters
2+
// dim: tracker analytics api dimension/filter id
3+
// header: tracker analytics api header name (query endpoints)
4+
15
const EVENT_DIMENSIONS = [
26
{
37
vis: 'ou',

src/modules/eventVisualization/eventVisualization.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { getHeaderByVis } from '../dimensions.js'
22
import { layoutGetAllDimensions } from '../layout/layoutGetAllDimensions.js'
33

4+
// Dimensions saved with program or program stage in an EventVisualization need
5+
// transformation before we can pass them to the pivot table engine
6+
47
export const transformEventVisualization = (vis) => {
58
// Do not modify the original visualization
69
const transformedVis = {
@@ -19,7 +22,7 @@ export const transformEventVisualization = (vis) => {
1922

2023
let headerName
2124

22-
layoutGetAllDimensions(vis).forEach((dim) => {
25+
layoutGetAllDimensions(transformedVis).forEach((dim) => {
2326
headerName = getHeaderByVis(dim.dimension)
2427

2528
if (dim.program?.id) {
@@ -30,4 +33,6 @@ export const transformEventVisualization = (vis) => {
3033
dim.dimension = headerName
3134
}
3235
})
36+
37+
return transformedVis
3338
}

src/modules/response/event/response.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import {
2020
import { applyDefaultHandler } from './default.js'
2121
import { applyOptionSetHandler } from './optionSet.js'
2222

23+
// Responses coming from these endpoints need transformation
24+
// before we can pass it to the pivot table engine:
25+
// - analytics/events/aggregate
26+
// - analytics/enrollments/aggregate
27+
2328
export const PREFIX_SEPARATOR = '_'
2429
export const NA_VALUE = ''
2530
export const NA_VALUE_ITEM = {
@@ -119,7 +124,6 @@ export const transformResponse = (response, { hideNaData = false } = {}) => {
119124
// Skip unsupported value types
120125
// Option set and Boolean have separate handlers
121126
// All other types use default handler with specific item formatter
122-
console.log('metaHeaders', metaHeaders)
123127
metaHeaders.forEach((header) => {
124128
if (
125129
!(

0 commit comments

Comments
 (0)