Skip to content

Commit

Permalink
Fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jingtang10 committed Sep 13, 2023
1 parent 05b9bf2 commit 9c2cef6
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,30 @@ class ResourceParamsBasedDownloadWorkManager(
throw FHIRException(response.issueFirstRep.diagnostics)
}

return if (response is Bundle && response.type == Bundle.BundleType.SEARCHSET) {
response.link
.firstOrNull { component -> component.relation == "next" }
?.url?.let { next -> urlOfTheNextPagesToDownloadForAResource.add(next) }

response.entry
.map { it.resource }
.also { resources ->
resources
.groupBy { it.resourceType }
.entries.map { map ->
map.value
.filter { it.meta.lastUpdated != null }
.let {
context.saveLastUpdatedTimestamp(
map.key,
it.maxOfOrNull { it.meta.lastUpdated }?.toTimeZoneString()
)
}
}
}
} else {
emptyList()
if ((response !is Bundle || response.type != Bundle.BundleType.SEARCHSET)) {
return emptyList()
}

response.link
.firstOrNull { component -> component.relation == "next" }
?.url?.let { next -> urlOfTheNextPagesToDownloadForAResource.add(next) }

return response.entry
.map { it.resource }
.also { resources ->
resources
.groupBy { it.resourceType }
.entries.map { map ->
map.value
.filter { it.meta.lastUpdated != null }
.let {
context.saveLastUpdatedTimestamp(
map.key,
it.maxOfOrNull { it.meta.lastUpdated }?.toTimeZoneString()
)
}
}
}
}

interface TimestampContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TransactionBundleGenerator(
httpVerbToUseForCreate: Bundle.HTTPVerb,
httpVerbToUseForUpdate: Bundle.HTTPVerb,
generatedBundleSize: Int,
useETagForUpload: Boolean
useETagForUpload: Boolean,
): TransactionBundleGenerator {

val createFunction =
Expand Down
Loading

0 comments on commit 9c2cef6

Please sign in to comment.