Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tests to sync classes #1505

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading