From 088c6686b6b948fd4220c8ea3191d25b03ab25da Mon Sep 17 00:00:00 2001 From: nickmorales Date: Fri, 23 Feb 2018 16:25:26 -0500 Subject: [PATCH] debugging --- lib/CXGN/Stock/Seedlot.pm | 6 ++++-- lib/SGN/Controller/AJAX/Seedlot.pm | 6 +++--- t/unit_fixture/CXGN/Stock/Seedlot.t | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/CXGN/Stock/Seedlot.pm b/lib/CXGN/Stock/Seedlot.pm index c1de184c6..fa98b157d 100644 --- a/lib/CXGN/Stock/Seedlot.pm +++ b/lib/CXGN/Stock/Seedlot.pm @@ -72,7 +72,7 @@ this is stored as a stockprop. =cut has 'box_name' => ( - isa => 'Str', + isa => 'Str|Undef', is => 'rw', lazy => 1, builder => '_retrieve_box_name', @@ -506,9 +506,10 @@ sub _retrieve_box_name { sub _retrieve_breeding_program { my $self = shift; my $experiment_type_id = SGN::Model::Cvterm->get_cvterm_row($self->schema(), "seedlot_experiment", "experiment_type")->cvterm_id(); + print STDERR $self->seedlot_id."\n"; my $project_rs = $self->schema()->resultset('Stock::Stock')->search({'me.stock_id'=>$self->seedlot_id})->search_related('nd_experiment_stocks')->search_related('nd_experiment', {'nd_experiment.type_id'=>$experiment_type_id})->search_related('nd_experiment_projects')->search_related('project'); if ($project_rs->count != 1){ - die "Seedlot does not have 1 breeding program project associated!\n"; + die "Seedlot does not have 1 breeding program project (".$project_rs->count.") associated!\n"; } my $breeding_program_id = $project_rs->first()->project_id(); my $breeding_program_name = $project_rs->first()->name(); @@ -527,6 +528,7 @@ sub _store_seedlot_relationships { if ($self->cross_stock_id){ $error = $self->_store_seedlot_cross(); } + print STDERR $error."\n"; if (!$error){ my $experiment_type_id = SGN::Model::Cvterm->get_cvterm_row($self->schema(), "seedlot_experiment", "experiment_type")->cvterm_id(); my $experiment = $self->schema->resultset('NaturalDiversity::NdExperiment')->create({ diff --git a/lib/SGN/Controller/AJAX/Seedlot.pm b/lib/SGN/Controller/AJAX/Seedlot.pm index 95769819e..afbb306e8 100644 --- a/lib/SGN/Controller/AJAX/Seedlot.pm +++ b/lib/SGN/Controller/AJAX/Seedlot.pm @@ -89,9 +89,9 @@ sub seedlot_base : Chained('/') PathPart('ajax/breeders/seedlot') CaptureArgs(1) $c->stash->{schema} = $c->dbic_schema("Bio::Chado::Schema"); $c->stash->{seedlot_id} = $seedlot_id; $c->stash->{seedlot} = CXGN::Stock::Seedlot->new( - schema => $c->stash->{schema}, - seedlot_id => $c->stash->{seedlot_id}, - ); + schema => $c->stash->{schema}, + seedlot_id => $c->stash->{seedlot_id}, + ); } sub seedlot_details :Chained('seedlot_base') PathPart('') Args(0) { diff --git a/t/unit_fixture/CXGN/Stock/Seedlot.t b/t/unit_fixture/CXGN/Stock/Seedlot.t index fb9769392..6f0dac541 100644 --- a/t/unit_fixture/CXGN/Stock/Seedlot.t +++ b/t/unit_fixture/CXGN/Stock/Seedlot.t @@ -14,6 +14,7 @@ my $schema = $f->bcs_schema(); my $seedlot_uniquename = 'seedlot1'; my $seedlot_location = 'seedlot1_location'; +my $seedlot_box_name = 'box1'; my $seedlot_accession_uniquename = 'test_accession1'; my $seedlot_accession_id = $schema->resultset('Stock::Stock')->find({uniquename=>$seedlot_accession_uniquename})->stock_id(); my $seedlot_breeding_program_name = "test"; @@ -24,6 +25,7 @@ my $seedlot_population_name = 'seedlot1_pop'; my $sl = CXGN::Stock::Seedlot->new(schema=>$schema); $sl->uniquename($seedlot_uniquename); $sl->location_code($seedlot_location); +$sl->box_name($seedlot_box_name); $sl->accession_stock_id($seedlot_accession_id); $sl->organization_name($seedlot_organization); $sl->population_name($seedlot_population_name); @@ -36,6 +38,7 @@ my $seedlot_id = $return->{seedlot_id}; my $s = CXGN::Stock::Seedlot->new(schema=>$schema, seedlot_id=>$seedlot_id); is($s->uniquename, $seedlot_uniquename); is($s->location_code, $seedlot_location); +is($s->box_name, $seedlot_box_name); is($s->organization_name, $seedlot_organization); is($s->population_name, $seedlot_population_name); is_deeply($s->accession, [$seedlot_accession_id, $seedlot_accession_uniquename] ); -- 2.11.4.GIT