Skip to content

Commit

Permalink
fix: getAuditInstancesInfoFromStudyUID not handle empty studyUID
Browse files Browse the repository at this point in the history
- Handle empty studyUID in getAuditInstancesInfoFromStudyUID function to
prevent unnecessary database query.
  • Loading branch information
Chinlinlee committed Nov 18, 2023
1 parent 90def2d commit 6b667a2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions models/sql/models/instance.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ class InstanceModel extends Model {
* @param {string} studyUID
*/
static async getAuditInstancesInfoFromStudyUID(studyUID) {
let instances = await sequelizeInstance.model("Instance").findAll({
where: {
x0020000D: studyUID
}
});

let instanceInfos = {
sopClassUIDs: [],
accessionNumbers: [],
patientID: "",
patientName: ""
};
if (!studyUID) return instanceInfos;

let instances = await sequelizeInstance.model("Instance").findAll({
where: {
x0020000D: studyUID
}
});

for (let instance of instances) {
let sopClassUID = instance.x00080016;
Expand Down

0 comments on commit 6b667a2

Please sign in to comment.