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

Fix issue with duplicated IDs inside the Knowledge Manager #2262

Closed
wants to merge 2 commits into from
Closed
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 @@ -124,7 +124,7 @@ internal constructor(
url != null && version != null ->
listOfNotNull(knowledgeDao.getResourceWithUrlAndVersion(url, version))
url != null -> listOfNotNull(knowledgeDao.getResourceWithUrl(url))
id != null -> listOfNotNull(knowledgeDao.getResourceWithUrlLike("%$id"))
id != null -> knowledgeDao.getResourceWithUrlLike(resType, "%/$id")
name != null && version != null ->
listOfNotNull(knowledgeDao.getResourcesWithNameAndVersion(resType, name, version))
name != null -> knowledgeDao.getResourcesWithName(resType, name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ abstract class KnowledgeDao {
): ResourceMetadataEntity?

// Remove after https://github.com/google/android-fhir/issues/1920
@Query("SELECT * from ResourceMetadataEntity WHERE url LIKE :urlPart")
@Query(
"SELECT * from ResourceMetadataEntity WHERE resourceType = :resourceType AND url LIKE :urlPart",
)
internal abstract suspend fun getResourceWithUrlLike(
resourceType: ResourceType,
urlPart: String,
): ResourceMetadataEntity?
): List<ResourceMetadataEntity>

@Query(
"SELECT * from ResourceMetadataEntity WHERE resourceType = :resourceType AND name = :name",
Expand Down