Skip to content

Commit

Permalink
feat: only add events when hitSubscriptions greater equal than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Jan 21, 2024
1 parent 92203aa commit c212fd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions api/dicom-web/controller/UPS-RS/service/cancel.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ class CancelWorkItemService extends BaseWorkItemService {

async addCancelEvent() {
let hitSubscriptions = await this.getHitSubscriptions(this.workItem);
let aeTitles = hitSubscriptions.map(v => v.aeTitle);

this.addUpsEvent(UPS_EVENT_TYPE.CancelRequested, this.upsInstanceUID, this.cancelRequestBy(), aeTitles);
if (hitSubscriptions.length > 0 ) {
let aeTitles = hitSubscriptions.map(v => v.aeTitle);
this.addUpsEvent(UPS_EVENT_TYPE.CancelRequested, this.upsInstanceUID, this.cancelRequestBy(), aeTitles);
}
}

cancelRequestBy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CreateWorkItemService extends BaseWorkItemService {

let hitSubscriptions = await this.getHitSubscriptions(workItem);

if (hitSubscriptions) {
if (hitSubscriptions?.length > 0 ) {
let hitSubscriptionAeTitleArray = hitSubscriptions.map(sub => sub.aeTitle);
this.addUpsEvent(UPS_EVENT_TYPE.StateReport, workItem.upsInstanceUID, this.stateReportOf(await workItem.toDicomJson()), hitSubscriptionAeTitleArray);
let assignedEventInformationArray = await this.getAssignedEventInformationArray(
Expand Down

0 comments on commit c212fd0

Please sign in to comment.