Skip to content

Commit

Permalink
Refactor string to number conversion in AnalyticsDatabaseService for …
Browse files Browse the repository at this point in the history
…improved readability
  • Loading branch information
simlarsen committed Nov 25, 2024
1 parent 481b095 commit 93027ec
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Common/Server/Services/AnalyticsDatabaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,19 @@ export default class AnalyticsDatabaseService<
continue;
}

// if value is of type string then convert it to number.
// if value is of type string then convert it to number.

if (
typeof (item as JSONObject)[
aggregateBy.aggregateColumnName as string
] === Typeof.String
) {
(item as JSONObject)[
aggregateBy.aggregateColumnName as string
] = Number.parseFloat(
(item as JSONObject)[
aggregateBy.aggregateColumnName as string
] as string,
);
(item as JSONObject)[aggregateBy.aggregateColumnName as string] =
Number.parseFloat(
(item as JSONObject)[
aggregateBy.aggregateColumnName as string
] as string,
);
}

const aggregatedModel: AggregatedModel = {
Expand Down

0 comments on commit 93027ec

Please sign in to comment.