Skip to content

BI-2127 Position Information missing from exp download file - #356

Merged
davedrp merged 5 commits into
developfrom
bug/BI-2127
May 22, 2024
Merged

BI-2127 Position Information missing from exp download file#356
davedrp merged 5 commits into
developfrom
bug/BI-2127

Conversation

@davedrp

@davedrpdavedrp commented May 14, 2024

Copy link
Copy Markdown
Contributor

Description

BI-2127 Position Information missing from exp download file

There were 2 separate problems:

  1. The row and column fields would only populate if there was data for both rowandcolumn. If a record only had data for row but not column or If a record only had data for column but not row, then the data for neither row or columnwould appear for that record.
  2. The data for Lat, 'Long, Elevation, and RTK` was not being added to the download spreadsheet.

Testing

  1. Import an experiment with row data but not column data.
  2. Import an experiment with column data but not row data.
  3. In the above two import files, include data for Lat, 'Long, Elevation, and RTK`
  4. Download the experiments

EXPECTED RESULTS
The download data should match the import data.

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <please include a link to TAF run>

@davedrp
davedrp requested review from a team, dmeidlin and mlm483 and removed request for a teamMay 14, 2024 13:08
@github-actionsgithub-actionsBot added the bug Something isn't working label May 14, 2024
@davedrp

Copy link
Copy Markdown
ContributorAuthor

@davedrp
davedrp marked this pull request as ready for review May 14, 2024 15:07
Comment on lines +504 to +506

//Row and Column
if ( ou.getObservationUnitPosition() != null ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it allowed to upload a file that has row but not column data or vice versa? I think this change makes sense regardless.



private String doubleToString(double val){
return Double.isNaN(val) ? null : String.valueOf( val );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice.

@davedrpdavedrp assigned mlm483 and unassigned dmeidlinMay 16, 2024
Comment on lines +472 to +476
// Lat, Long, Elevation
Coordinates coordinates = extractCoordinates(ou);
row.put( ExperimentObservation.Columns.LAT, coordinates==null? null : doubleToString(coordinates.getLat()) );
row.put( ExperimentObservation.Columns.LONG, coordinates==null? null : doubleToString(coordinates.getLon()) );
row.put( ExperimentObservation.Columns.ELEVATION, coordinates==null? null : doubleToString(coordinates.getAlt()) );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Refactoring using Optionals here might help the readability.

Suggested change
// Lat, Long, Elevation
Coordinatescoordinates = extractCoordinates(ou);
row.put( ExperimentObservation.Columns.LAT, coordinates==null? null : doubleToString(coordinates.getLat()) );
row.put( ExperimentObservation.Columns.LONG, coordinates==null? null : doubleToString(coordinates.getLon()) );
row.put( ExperimentObservation.Columns.ELEVATION, coordinates==null? null : doubleToString(coordinates.getAlt()) );
// Lat, Long, Elevation
Coordinatescoordinates = extractCoordinates(ou);
Optional.ofNullable(coordinates)
.map(c -> doubleToString(c.getLat()))
.ifPresent(lat -> row.put(ExperimentObservation.Columns.LAT, lat));
Optional.ofNullable(coordinates)
.map(c -> doubleToString(c.getLon()))
.ifPresent(lon -> row.put(ExperimentObservation.Columns.LONG, lon));
Optional.ofNullable(coordinates)
.map(c -> doubleToString(c.getAlt()))
.ifPresent(elevation -> row.put(ExperimentObservation.Columns.ELEVATION, elevation));

@davedrp
davedrp requested a review from dmeidlinMay 17, 2024 20:27
@davedrp
davedrp merged commit 6662651 into developMay 22, 2024
@davedrp
davedrp deleted the bug/BI-2127 branch May 22, 2024 16:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@davedrp@dmeidlin@mlm483