# HG changeset patch # User Alain Mazy # Date 1764095620 -3600 # Node ID 87138d16a90d255f9b606764a7d101a791128697 # Parent 31e793f606bc97f22cd6e56788cbd4c8bb6f1f93 Avoid adding twice the same tag in DB for the same resource diff -r 31e793f606bc -r 87138d16a90d NEWS --- a/NEWS Tue Nov 25 16:07:04 2025 +0100 +++ b/NEWS Tue Nov 25 19:33:40 2025 +0100 @@ -68,6 +68,9 @@ while downloading the response. * Fix issue #227: In SQL, string literals must use 'single quotes' https://stackoverflow.com/a/25141338 +* Fix: Avoid adding twice the same tag in DB for the same resource e.g. when you have added TimeZoneOffsetFromUTC + to the ExtraMainDicomTags at Patient level. + https://discourse.orthanc-server.org/t/jobs-api-the-dicommovescu-job-doesnt-seems-to-track-progress/3140/14 * Upgraded dependencies for static builds: - civetweb 1.16, including patch for CVE-2025-55763 - SQLite 3.50.4 diff -r 31e793f606bc -r 87138d16a90d OrthancServer/Sources/Database/ResourcesContent.h --- a/OrthancServer/Sources/Database/ResourcesContent.h Tue Nov 25 16:07:04 2025 +0100 +++ b/OrthancServer/Sources/Database/ResourcesContent.h Tue Nov 25 19:33:40 2025 +0100 @@ -122,6 +122,8 @@ ListTags tags_; ListMetadata metadata_; + std::map > mainDicomTagsPerResource_; + public: explicit ResourcesContent(bool isNewResource) : isNewResource_(isNewResource) @@ -132,7 +134,18 @@ const DicomTag& tag, const std::string& value) { - tags_.push_back(TagValue(resourceId, false, tag, value)); + // avoid adding twice the same tag for the same resource e.g, when the same tag is registered at study and patient level + // https://discourse.orthanc-server.org/t/jobs-api-the-dicommovescu-job-doesnt-seems-to-track-progress/3140/14 + if (mainDicomTagsPerResource_.find(resourceId) == mainDicomTagsPerResource_.end()) + { + mainDicomTagsPerResource_[resourceId] = std::set(); + } + + if (mainDicomTagsPerResource_[resourceId].find(tag) == mainDicomTagsPerResource_[resourceId].end()) + { + tags_.push_back(TagValue(resourceId, false, tag, value)); + mainDicomTagsPerResource_[resourceId].insert(tag); + } } void AddIdentifierTag(int64_t resourceId,