Skip to content

Commit

Permalink
catalog: fix project include issues, #TASK-4851
Browse files Browse the repository at this point in the history
  • Loading branch information
pfurio committed Aug 9, 2023
1 parent 41b33a1 commit b176eb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ Study insert(ClientSession clientSession, Project project, Study study)
}

@Override
public OpenCGAResult<Study> getAllStudiesInProject(long projectId, QueryOptions options) throws CatalogDBException {
public OpenCGAResult<Study> getAllStudiesInProject(long projectUid, QueryOptions options) throws CatalogDBException {
long startTime = startQuery();
dbAdaptorFactory.getCatalogProjectDbAdaptor().checkId(projectId);
Query query = new Query(QueryParams.PROJECT_ID.key(), projectId);
dbAdaptorFactory.getCatalogProjectDbAdaptor().checkId(projectUid);
Query query = new Query(QueryParams.PROJECT_UID.key(), projectUid);
return endQuery(startTime, get(query, options));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ private boolean includeStudyInfo() {
return true;
} else if (options.containsKey(QueryOptions.INCLUDE)) {
List<String> list = options.getAsStringList(QueryOptions.INCLUDE);
for (String exclude : list) {
if (exclude.equals("studies") || exclude.equals("projects.studies")) {
for (String include : list) {
if (include.startsWith("studies") || include.startsWith("projects.studies")) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@ public OpenCGAResult<Integer> incrementRelease(String projectStr, String session
int currentRelease = project.getCurrentRelease();

// Check current release has been used at least in one study or file or cohort or individual...
List<Study> allStudiesInProject = project.getStudies();
QueryOptions studyOptions = keepFieldInQueryOptions(StudyManager.INCLUDE_STUDY_IDS, StudyDBAdaptor.QueryParams.RELEASE.key());
OpenCGAResult<Study> studyResult = studyDBAdaptor.getAllStudiesInProject(projectUid, studyOptions);
List<Study> allStudiesInProject = studyResult.getResults();
if (allStudiesInProject.isEmpty()) {
throw new CatalogException("Cannot increment current release number. No studies found for release " + currentRelease);
}
Expand Down

0 comments on commit b176eb7

Please sign in to comment.