2 package CXGN
::AerialImagingEventProject
;
6 extends
'CXGN::Project';
8 use SGN
::Model
::Cvterm
;
11 =head2 function get_associated_image_band_projects()
14 Desc: returns the associated image band projects for this imaging event project
15 Ret: returns an arrayref [ id, name ] of arrayrefs
22 sub get_associated_image_band_projects
{
24 my $drone_run_on_drone_run_band_type_id = SGN
::Model
::Cvterm
->get_cvterm_row($self->bcs_schema, 'drone_run_band_on_drone_run', 'project_relationship')->cvterm_id();
25 my $q = "SELECT drone_run_band.project_id, drone_run_band.name
26 FROM project AS drone_run
27 JOIN project_relationship on (drone_run.project_id = project_relationship.object_project_id AND project_relationship.type_id = $drone_run_on_drone_run_band_type_id)
28 JOIN project AS drone_run_band ON (drone_run_band.project_id = project_relationship.subject_project_id)
29 WHERE drone_run.project_id = ?;";
30 my $h = $self->bcs_schema->storage->dbh()->prepare($q);
31 $h->execute($self->get_trial_id);
32 my @image_band_projects;
33 while (my ($drone_run_band_project_id, $drone_run_band_name) = $h->fetchrow_array()) {
34 push @image_band_projects, [$drone_run_band_project_id, $drone_run_band_name];
36 return \
@image_band_projects;
39 =head2 accessors get_drone_run_date(), set_drone_run_date()
50 sub get_drone_run_date
{
53 my $date_cvterm_id = SGN
::Model
::Cvterm
->get_cvterm_row($self->bcs_schema, 'project_start_date', 'project_property')->cvterm_id();
54 my $row = $self->bcs_schema->resultset('Project::Projectprop')->find({
55 project_id
=> $self->get_trial_id(),
56 type_id
=> $date_cvterm_id,
59 my $calendar_funcs = CXGN
::Calendar
->new({});
62 my $date = $calendar_funcs->display_start_date($row->value());
69 sub set_drone_run_date
{
73 my $calendar_funcs = CXGN
::Calendar
->new({});
75 if (my $event = $calendar_funcs->check_value_format($date) ) {
77 my $date_cvterm_id = SGN
::Model
::Cvterm
->get_cvterm_row($self->bcs_schema, 'project_start_date', 'project_property')->cvterm_id();
79 my $row = $self->bcs_schema->resultset('Project::Projectprop')->find_or_create({
80 project_id
=> $self->get_trial_id(),
81 type_id
=> $date_cvterm_id,
87 print STDERR
"date format did not pass check: $date \n";