Skip to content

Commit

Permalink
Handle entryType when storing/updating observation units
Browse files Browse the repository at this point in the history
  • Loading branch information
timparsons committed Aug 31, 2023
1 parent db87e84 commit 20c2d12
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/CXGN/BrAPI/v2/ObservationUnits.pm
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ sub observationunits_update {
my $level_number = $params->{observationUnitPosition}->{observationLevel}->{levelCode} ? $params->{observationUnitPosition}->{observationLevel}->{levelCode} : undef;
my $raw_additional_info = $params->{additionalInfo} || undef;
my $is_a_control = $raw_additional_info->{control} ? $raw_additional_info->{control} : undef;

my $entry_type = $params->{observationUnitPosition}->{entryType} ? $params->{observationUnitPosition}->{entryType} : undef;
my $is_a_control = $params->{additionalInfo}->{control} ? $params->{additionalInfo}->{control} : undef;

# BrAPI entryType overrides additionalinfo.control
if ($entry_type) {
$is_a_control = uc($entry_type) eq 'CHECK' ? 1 : 0;
}

my $range_number = $raw_additional_info->{range} ? $raw_additional_info->{range} : undef;
my %specific_keys = map { $_ => 1 } ("observationUnitParent","control","range");
my %additional_info;
Expand Down Expand Up @@ -629,7 +638,14 @@ sub observationunits_store {
my $plot_parent_id = $params->{additionalInfo}->{observationUnitParent} ? $params->{additionalInfo}->{observationUnitParent} : undef;
my $accession_id = $params->{germplasmDbId} ? $params->{germplasmDbId} : undef;
my $accession_name = $params->{germplasmName} ? $params->{germplasmName} : undef;
my $entry_type = $params->{observationUnitPosition}->{entryType} ? $params->{observationUnitPosition}->{entryType} : undef;
my $is_a_control = $params->{additionalInfo}->{control} ? $params->{additionalInfo}->{control} : undef;

# BrAPI entryType overrides additionalinfo.control
if ($entry_type) {
$is_a_control = uc($entry_type) eq 'CHECK' ? 1 : 0;
}

my $range_number = $params->{additionalInfo}->{range} ? $params->{additionalInfo}->{range} : undef;
my $row_number = $params->{observationUnitPosition}->{positionCoordinateY} ? $params->{observationUnitPosition}->{positionCoordinateY} : undef;
my $col_number = $params->{observationUnitPosition}->{positionCoordinateX} ? $params->{observationUnitPosition}->{positionCoordinateX} : undef;
Expand Down

0 comments on commit 20c2d12

Please sign in to comment.