Skip to content

Commit

Permalink
- CHG: Version bump for bugfix release.
Browse files Browse the repository at this point in the history
- FIX: Fixed issues with trait data import duplicate plot detection.
  • Loading branch information
sebastian-raubach committed Jun 5, 2024
1 parent 0f67f8f commit 8e9f711
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 45 deletions.
67 changes: 42 additions & 25 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'uk.ac.hutton.germinate-importer'
version '4.7.2'
version '4.7.3'

compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 11
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ private void checkCollaboratorsSheet(Sheet s)
addImportResult(ImportStatus.GENERIC_MISSING_REQUIRED_VALUE, r.getRowNum(), "First Name");
if (StringUtils.isEmpty(lastName))
addImportResult(ImportStatus.GENERIC_MISSING_REQUIRED_VALUE, r.getRowNum(), "Last Name");
if (!StringUtils.isEmpty(country) && !countryCode2ToId.containsKey(country))
addImportResult(ImportStatus.GENERIC_INVALID_COUNTRY_CODE, r.getRowNum(), country);
// if (!StringUtils.isEmpty(country) && !countryCode2ToId.containsKey(country))
// addImportResult(ImportStatus.GENERIC_INVALID_COUNTRY_CODE, r.getRowNum(), country);
});
}
catch (IOException e)
Expand Down Expand Up @@ -543,22 +543,27 @@ private void getOrCreateCollaborators(DSLContext context, ReadableWorkbook wb)
String address = getCellValue(r, collaboratorLabelToColIndex.get("Address"));
String countryCode = getCellValue(r, collaboratorLabelToColIndex.get("Country"));

Integer countryId = countryCode2ToId.get(countryCode);

InstitutionsRecord institution = context.selectFrom(INSTITUTIONS)
.where(INSTITUTIONS.NAME.isNotDistinctFrom(institutionName))
.and(INSTITUTIONS.ADDRESS.isNotDistinctFrom(address))
.and(INSTITUTIONS.COUNTRY_ID.isNotDistinctFrom(countryId))
.fetchAny();
InstitutionsRecord institution = null;

if (!StringUtils.isEmpty(institutionName) && institution == null)
if (!StringUtils.isEmpty(institutionName))
{
institution = context.newRecord(INSTITUTIONS);
institution.setName(institutionName);
institution.setAddress(address);
institution.setCountryId(countryId);
institution.setCreatedOn(new Timestamp(System.currentTimeMillis()));
institution.store();
Integer countryId = countryCode2ToId.get(countryCode);

institution = context.selectFrom(INSTITUTIONS)
.where(INSTITUTIONS.NAME.isNotDistinctFrom(institutionName))
.and(INSTITUTIONS.ADDRESS.isNotDistinctFrom(address))
.and(INSTITUTIONS.COUNTRY_ID.isNotDistinctFrom(countryId))
.fetchAny();

if (institution == null)
{
institution = context.newRecord(INSTITUTIONS);
institution.setName(institutionName);
institution.setAddress(address);
institution.setCountryId(countryId);
institution.setCreatedOn(new Timestamp(System.currentTimeMillis()));
institution.store();
}
}

CollaboratorsRecord collaborator = context.selectFrom(COLLABORATORS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected void checkFile()
for (Map.Entry<String, ViewTableImages> entry : filenameToImage.entrySet())
{
if (!filenames.contains(entry.getKey()))
addImportResult(ImportStatus.IMAGE_IMAGE_MISSING, -1, "Image not found for template definition: '" + entry.getValue().getImageForeignId() + "-" + entry.getValue().getReferenceName());
addImportResult(ImportStatus.IMAGE_IMAGE_MISSING, -1, "Image not found for template definition: '" + entry.getKey() + "(foreign id: + " + entry.getValue().getImageForeignId() + ", reference name: " + entry.getValue().getReferenceName() + ")");
}
}
catch (IOException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ private void checkRowColumn(Row r)
String germplasm = getCellValue(r, dataColumnNameToIndex, "Line/Phenotype");
String row = getCellValue(r, dataColumnNameToIndex, "Row");
String column = getCellValue(r, dataColumnNameToIndex, "Column");
String location = getCellValue(r, dataColumnNameToIndex, "Location");

if (row != null)
{
Expand Down Expand Up @@ -310,11 +311,11 @@ private void checkRowColumn(Row r)

if (!StringUtils.isEmpty(row) || !StringUtils.isEmpty(column))
{
String key = row + "|" + column;
String key = row + "|" + column + "|" + location;
String value = rowColToGermplasm.get(key);

if (!StringUtils.isEmpty(value) && !Objects.equals(germplasm, value))
addImportResult(ImportStatus.TRIALS_ROW_COL_MISMATCH, r.getRowNum(), "Row: " + row + ", Column: " + column);
addImportResult(ImportStatus.TRIALS_ROW_COL_MISMATCH, r.getRowNum(), "Row: " + row + ", Column: " + column + ", Location: " + location);
else
rowColToGermplasm.put(key, germplasm);
}
Expand Down

0 comments on commit 8e9f711

Please sign in to comment.