Skip to content

Commit

Permalink
fix: use arg name depending on report version (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwinter authored Nov 11, 2024
1 parent de169dc commit e60f01c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,19 @@ class ReportCalculationController(
val args = mutableMapOf<String, String>()

if (from != null) {
args["from"] = from.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
if (report.version == 1) {
args["from"] = from.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
} else {
args["startDate"] = from.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
}
}

if (to != null) {
args["to"] = to.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
if (report.version == 1) {
args["to"] = to.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
} else {
args["endDate"] = to.toInstant().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME)
}
}

val createReportCalculationResponse = createReportCalculationUseCase.createReportCalculation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class DefaultReportCalculationUseCase(
) : ReportCalculationUseCase() {

override fun apply(request: ReportCalculationRequest): UseCaseOutcome<ReportCalculationData> {

val reportCalculation: ReportCalculation = try {
reportCalculationStorage.fetchReportCalculation(
DomainReference(request.reportCalculationId)
Expand Down Expand Up @@ -100,7 +99,6 @@ class DefaultReportCalculationUseCase(
private fun handleSqlReport(
report: Report, reportCalculation: ReportCalculation
): UseCaseOutcome<ReportCalculationData> {

for ((argKey: String, transformationKeys: List<String>) in report.transformations) {
handleTransformations(argKey, transformationKeys, reportCalculation.args)
}
Expand Down

0 comments on commit e60f01c

Please sign in to comment.