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

IBP-2757 Trial instance variable is missing in import dataset #814

Open
wants to merge 2 commits into
base: master
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
Original file line number Diff line number Diff line change
Expand Up @@ -326,46 +326,15 @@ public Map<String, Object> processForm(
// routing logic for existing study vs new study details
final Integer studyId = form.getStudyDetails().getStudyId();
this.userSelection.setStudyId(studyId);
if (studyId != null && studyId != 0) {
final List<String> errors = new ArrayList<>();
Map<String, List<Message>> mismatchErrors = null;
final boolean isMeansDataImport = this.userSelection.getDatasetType() != null
&& this.userSelection.getDatasetType() == DatasetTypeEnum.MEANS_DATA.getId();

try {
// check if the selected dataset still has no mapped headers
if (isMeansDataImport) {
if (!this.etlService.hasMeansDataset(studyId)) {
return this.wrapFormResult(AngularMapOntologyController.URL, request);
}
} else {
if (!this.etlService.hasMeasurementEffectDataset(studyId)) {
return this.wrapFormResult(AngularMapOntologyController.URL, request);
}
}

mismatchErrors = this.checkForMismatchedHeaders(errors, mismatchErrors, isMeansDataImport);

if (mismatchErrors != null && !mismatchErrors.isEmpty()) {
for (final Map.Entry<String, List<Message>> entry : mismatchErrors.entrySet()) {
errors.addAll(this.etlService.convertMessageList(entry.getValue()));
}
return this.wrapFormResult(errors);
} else {
return this.wrapFormResult(AngularOpenSheetController.URL, request);
}
final boolean isMeansDataImport = this.userSelection.getDatasetType() != null
&& this.userSelection.getDatasetType() == DatasetTypeEnum.MEANS_DATA.getId();

} catch (final Exception e) {
AngularSelectSheetController.LOG.error(e.getMessage(), e);
final List<Message> error = new ArrayList<>();
error.add(new Message(Constants.MESSAGE_KEY_GENERIC_ERROR));
errors.addAll(this.etlService.convertMessageList(error));
return this.wrapFormResult(errors);
}
} else {
// check if the selected dataset still has no mapped headers
if (isMeansDataImport) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuenyad seems like this if does not make so much sense. It returns the same if condition is true or false.

return this.wrapFormResult(AngularMapOntologyController.URL, request);
}

return this.wrapFormResult(AngularMapOntologyController.URL, request);
}

List<Message> validate(final ConsolidatedStepForm form) throws IOException, WorkbookParserException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ <h3 id="myModalLabel" ng-bind="label">Select Row Containing Column Headers</h3>
$scope.messages = data.messages;
$scope.userAttemptedSubmission = false;
}
}).error(function (error) {
$scope.messages.push(error);
});
} else {
$scope.userAttemptedSubmission = false;
Expand Down