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

CRDCDH-1832 #553

Open
wants to merge 1 commit into
base: 3.2.0
Choose a base branch
from
Open
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
11 changes: 7 additions & 4 deletions services/qc-result-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class QcResultService{
record.error.title,
replaceErrorString(record.error.desc, `'${record.fileName}'`)
);
return QCResult.create(VALIDATION.TYPES.DATA_FILE, VALIDATION.TYPES.DATA_FILE, record.fileName, null, null, VALIDATION_STATUS.ERROR, getCurrentTime(), getCurrentTime(), [errorMsg], [], record.dataRecordID);
return QCResult.create(VALIDATION.TYPES.DATA_FILE, VALIDATION.TYPES.DATA_FILE, record.fileName, null, null, VALIDATION_STATUS.ERROR, getCurrentTime(), getCurrentTime(), [errorMsg], [], record.dataRecordID, record?.origin);
});

await Promise.all(qcResultErrors.map(async (qcResult) => {
Expand All @@ -153,7 +153,7 @@ class QcResultService{
}

class QCResult {
constructor(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID) {
constructor(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID, origin) {
this.type = type;
this.validationType = validationType;
this.submittedID = submittedID;
Expand All @@ -165,10 +165,13 @@ class QCResult {
this.errors = errors || [];
this.warnings = warnings || [];
this.dataRecordID = dataRecordID;
if (origin) {
this.origin = origin;
}
}

static create(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID) {
return new QCResult(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID);
static create(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID, origin) {
return new QCResult(type, validationType, submittedID, batchID, displayID, severity, uploadedDate, validatedDate, errors, warnings, dataRecordID, origin);
}

}
Expand Down
3 changes: 2 additions & 1 deletion services/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {getCurrentTime, subtractDaysFromNow} = require("../crdc-datahub-database-
const {HistoryEventBuilder} = require("../domain/history-event");
const {verifySession, verifySubmitter} = require("../verifier/user-info-verifier");
const {verifySubmissionAction} = require("../verifier/submission-verifier");
const {getSortDirection} = require("../crdc-datahub-database-drivers/utility/mongodb-utility");
const {formatName} = require("../utility/format-name");
const ERROR = require("../constants/error-constants");
const USER_CONSTANTS = require("../crdc-datahub-database-drivers/constants/user-constants");
Expand Down Expand Up @@ -41,6 +40,7 @@ const FINAL_INACTIVE_REMINDER = "finalInactiveReminder";
const SUBMISSION_ID = "Submission ID";
const DATA_SUBMISSION_TYPE = "Data Submission Type";
const DESTINATION_LOCATION = "Destination Location";
const SUBMISSION_STATS_ORIGIN_API = "API: submissionStats";
// Set to array
Set.prototype.toArray = function() {
return Array.from(this);
Expand Down Expand Up @@ -1275,6 +1275,7 @@ class Submission {
.filter(fileName => !qcResultFileNames.has(fileName))
.map(fileName => ({
fileName,
origin: SUBMISSION_STATS_ORIGIN_API,
dataRecordID: null,
error: {
title: ERROR.MISSING_DATA_NODE_FILE_TITLE,
Expand Down