Skip to content

Commit 82f7a31

Browse files
committed
Updated some comments
1 parent b88eeb9 commit 82f7a31

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

Apteco.ApiDataAggregator.Core/Services/CubesService.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public async Task<List<string>> CalculateCube(string systemName, SessionDetails
106106
#region private methods
107107
private void AddMeaureToData(List<string> data, Measure measure, MeasureResult measureResult, List<DimensionResult> dimensionResults)
108108
{
109+
//The CubeDimensionHeaders private class is used to convert an n-dimensional cube into a series of 2D tables to output.
109110
CubeDimensionHeaders cubeDimensionHeaders = new CubeDimensionHeaders(dimensionResults);
110111

111112
if (measureResult.Rows.Count < 1)
@@ -116,20 +117,19 @@ private void AddMeaureToData(List<string> data, Measure measure, MeasureResult m
116117
{
117118
data.Add(dimensionResults[0].HeaderDescriptions);
118119
data.Add(measureResult.Rows[0]);
120+
return;
119121
}
120-
else
122+
123+
for (int rowIndex = 0; rowIndex < measureResult.Rows.Count; rowIndex++)
121124
{
122-
for (int rowIndex = 0; rowIndex < measureResult.Rows.Count; rowIndex++)
125+
int dimension1Index = cubeDimensionHeaders.GetItemIndex(rowIndex, 1);
126+
if (dimension1Index == 0)
123127
{
124-
int dimension1Index = cubeDimensionHeaders.GetItemIndex(rowIndex, 1);
125-
if (dimension1Index == 0)
126-
{
127-
data.Add("");
128-
data.Add(GetSubCubeDescription(rowIndex, cubeDimensionHeaders));
129-
data.Add("\t" + dimensionResults[0].HeaderDescriptions);
130-
}
131-
data.Add(cubeDimensionHeaders.GetDimensionHeader(1, dimension1Index) + "\t" + measureResult.Rows[rowIndex]);
128+
data.Add("");
129+
data.Add(GetSubCubeDescription(rowIndex, cubeDimensionHeaders));
130+
data.Add("\t" + dimensionResults[0].HeaderDescriptions);
132131
}
132+
data.Add(cubeDimensionHeaders.GetDimensionHeader(1, dimension1Index) + "\t" + measureResult.Rows[rowIndex]);
133133
}
134134
}
135135

@@ -145,6 +145,7 @@ private string GetMeasureDescription(Measure measure)
145145
}
146146
}
147147

148+
//Get the name of each 2D cube, by finding the points of each dimension bigger then the first 2D.
148149
private string GetSubCubeDescription(int rowIndex, CubeDimensionHeaders cubeDimensionHeaders)
149150
{
150151
List<string> descriptions = new List<string>();

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ through the following steps:
3939

4040
1. Logs in to the API at the specified URL
4141
2. Gets the definition of a saved query from the `/{dataViewName}/Queries/{systemName}/GetFileSync` endpoint.
42-
3. Gets the resolve table for the query and looks up the reference (URN) variable for this table. The endpoint used is
43-
`/{dataViewName}/FastStatsSystems/{systemName}/Variables` with a filter applied.
44-
4. If there is a reference variable found this is added to the list of variables the user provided on the command line.
45-
5. Creates a set of export column definitions from the list of variable names provided on the command line.
46-
6. Submits an export request with the given query and list of columns. The endpoint used is
47-
`/{dataViewName}/Exports/{systemName}/ExportSync`
48-
7. Outputs the resulting rows to the console.
42+
3. Checks the given variable names are all selector variables, as these can be added to cubes without further
43+
processing. Other variable types can be added as cube dimensions, but require bandings or other types of cubes.
44+
4. Creates a set of cube dimensions from the given variables and a single count measure (although cubes can process
45+
multiple measures if they are specified).
46+
5. Submits a cube request with the given query and list of dimensions and measurse. The endpoint used is
47+
`/{dataViewName}/Cubes/{systemName}/CalculateSync`
48+
6. Formats the resulting n-dimensional cube as a series of 2-dimensional tables and outputs them to the console.
4949

5050
### Implementation
5151
* To see how the ApiClient code was generated from the API's Swagger specification, look at the

0 commit comments

Comments
 (0)