From 5d417b39ce4007e5291faaa99028993e8be5b30b Mon Sep 17 00:00:00 2001 From: nickmorales Date: Mon, 19 Sep 2016 13:55:27 +0000 Subject: [PATCH] minor checks to generate plot pheno --- lib/SGN/Controller/AJAX/DeriveTrait.pm | 13 +++++++++++-- lib/SGN/Controller/AJAX/PhenotypesUpload.pm | 2 +- mason/breeders_toolbox/trial/derived_trait.mas | 12 +++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/SGN/Controller/AJAX/DeriveTrait.pm b/lib/SGN/Controller/AJAX/DeriveTrait.pm index 64682aa39..51aa3ac5c 100644 --- a/lib/SGN/Controller/AJAX/DeriveTrait.pm +++ b/lib/SGN/Controller/AJAX/DeriveTrait.pm @@ -327,6 +327,7 @@ sub generate_plot_phenotypes : Path('/ajax/breeders/trial/generate_plot_phenotyp if (scalar(@$modes > 1)) { $info{'notes'} = 'More than one mode!'; $info{'value_to_store'} = ''; + $info{'flag_notes'} = 1; } else { $info{'notes'} = 'A single mode was found!'; $info{'value_to_store'} = $modes->[0]; @@ -383,7 +384,15 @@ sub store_generated_plot_phenotypes : Path('/ajax/breeders/trial/store_generated #print STDERR Dumper $plots; #print STDERR Dumper $traits; #print STDERR $overwrite_values; - + + if ($overwrite_values) { + my $user_type = $c->user()->get_object->get_user_type(); + #print STDERR $user_type."\n"; + if ($user_type ne 'curator') { + $c->stash->{rest} = {error => 'Must be a curator to overwrite values! Please contact us!'}; + } + } + $parse_result{'data'} = $data; $parse_result{'plots'} = $plots; $parse_result{'traits'} = $traits; @@ -399,7 +408,7 @@ sub store_generated_plot_phenotypes : Path('/ajax/breeders/trial/store_generated my $store_error = CXGN::Phenotypes::StorePhenotypes->store($c, $size, $plots, $traits, $data, \%phenotype_metadata, 'plot', $overwrite_values ); if ($store_error) { - $c->stash->{rest} = {error => $store_error} + $c->stash->{rest} = {error => $store_error}; } $c->stash->{rest} = {success => 1}; } diff --git a/lib/SGN/Controller/AJAX/PhenotypesUpload.pm b/lib/SGN/Controller/AJAX/PhenotypesUpload.pm index 6b97349bd..30c39e860 100644 --- a/lib/SGN/Controller/AJAX/PhenotypesUpload.pm +++ b/lib/SGN/Controller/AJAX/PhenotypesUpload.pm @@ -141,7 +141,7 @@ sub _prep_upload { my $overwrite_values = $c->req->param('phenotype_upload_overwrite_values'); if ($overwrite_values) { my $user_type = $c->user()->get_object->get_user_type(); - print STDERR $user_type."\n"; + #print STDERR $user_type."\n"; if ($user_type ne 'curator') { push @error_status, 'Must be a curator to overwrite values! Please contact us!'; } diff --git a/mason/breeders_toolbox/trial/derived_trait.mas b/mason/breeders_toolbox/trial/derived_trait.mas index 99c96e2a0..3bcb5c603 100644 --- a/mason/breeders_toolbox/trial/derived_trait.mas +++ b/mason/breeders_toolbox/trial/derived_trait.mas @@ -174,10 +174,16 @@ jQuery(document).ready(function () { jQuery("#working_modal").modal("show"); }, success: function(response){ - console.log(response); + //console.log(response); var html = '
Trait: '+response.trait_name+'
Method: '+response.method+'
Rounding: '+response.rounding+'
'; for (var i=0; i'; + html = html + ''; + if (response.info[i].flag_notes) { + html = html + ''; + } else { + html = html + ''; + } + html = html + ''; } html = html +'
PlotPlant ValuesCalculation OutputValue to StoreNotes
'+response.info[i].plot_name+''+response.info[i].plant_values+''+response.info[i].output+''+response.info[i].value_to_store+''+response.info[i].notes+'
'+response.info[i].plot_name+''+response.info[i].plant_values+''+response.info[i].output+''+response.info[i].value_to_store+''+response.info[i].notes+''+response.info[i].notes+'
'; jQuery('#generate_plot_pheno_preview').empty().html(html); @@ -205,7 +211,7 @@ jQuery(document).ready(function () { jQuery("#working_modal").modal("show"); }, success: function(response){ - console.log(response); + //console.log(response); jQuery("#working_modal").modal("hide"); //alert('Successfully saved!'); } -- 2.11.4.GIT