From 8364b53e759e3d7ced36dad2404c2d6b09d60d5b Mon Sep 17 00:00:00 2001 From: bellerbrock Date: Mon, 17 Oct 2022 13:10:55 -0400 Subject: [PATCH] sort plots for add treatment dialog --- js/source/legacy/CXGN/BreedersToolbox/AddTrial.js | 9 ++++++--- mason/breeders_toolbox/trial/trial_treatments.mas | 12 +++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/source/legacy/CXGN/BreedersToolbox/AddTrial.js b/js/source/legacy/CXGN/BreedersToolbox/AddTrial.js index daf30d395..8878fbea0 100644 --- a/js/source/legacy/CXGN/BreedersToolbox/AddTrial.js +++ b/js/source/legacy/CXGN/BreedersToolbox/AddTrial.js @@ -1992,7 +1992,7 @@ jQuery(document).ready(function ($) { 'inherits_plot_treatments' : inherits_plot_treatments, }, success: function(response) { - console.log(response); + //console.log(response); if (response.error) { alert(response.error); } @@ -2267,12 +2267,15 @@ jQuery(document).ready(function ($) { html += ""; var design_hash = JSON.parse(design_array[i]); //console.log(design_hash); - for (var key in design_hash){ + var keys = Object.keys(design_hash); + keys.sort(); + keys.forEach(function(key){ if (key != 'treatments'){ var plot_obj = design_hash[key]; + //console.log(plot_obj); html += ""; } - } + }); html += "
plot_nameaccessionplot_numberblock_numberrep_numberis_a_controlrow_numbercol_number"+treatment_name+" [Select all ]
"+plot_obj.plot_name+""+plot_obj.stock_name+""+plot_obj.plot_number+""+plot_obj.block_number+""+plot_obj.rep_number+""+plot_obj.is_a_control+""+plot_obj.row_number+""+plot_obj.col_number+"
"; } html += "

"; diff --git a/mason/breeders_toolbox/trial/trial_treatments.mas b/mason/breeders_toolbox/trial/trial_treatments.mas index db5c4b121..0d28b8c33 100644 --- a/mason/breeders_toolbox/trial/trial_treatments.mas +++ b/mason/breeders_toolbox/trial/trial_treatments.mas @@ -73,27 +73,29 @@ jQuery(document).ready(function () { success: function(response){ //console.log(response); var design_hash = response.design; + var keys = Object.keys(design_hash); + keys.sort(); var html = ""; if(treatment_unit == 'plot'){ html += ""; - for (var key in design_hash){ + keys.forEach(function(key){ var plot_obj = design_hash[key]; html += ""; - } + }); html += "
plot_nameaccessionplot_numberblock_numberrep_numberis_a_controlrow_numbercol_number"+treatment_name+" [Select all ]
"+plot_obj.plot_name+""+plot_obj.accession_name+""+plot_obj.plot_number+""+plot_obj.block_number+""+plot_obj.rep_number+""+plot_obj.is_a_control+""+plot_obj.row_number+""+plot_obj.col_number+"
"; } if(treatment_unit == 'plant'){ html += ""; - for (var key in design_hash){ + keys.forEach(function(key){ var plot_obj = design_hash[key]; var plant_names = plot_obj['plant_names']; var plant_ids = plot_obj['plant_ids']; for (var i=0; i"+plant_names[i]+""; } - } + }); html += "
plant_nameaccessionplot_numberblock_numberrep_numberis_a_controlrow_numbercol_number"+treatment_name+" [Select all ]
"+plot_obj.accession_name+""+plot_obj.plot_number+""+plot_obj.block_number+""+plot_obj.rep_number+""+plot_obj.is_a_control+""+plot_obj.row_number+""+plot_obj.col_number+"
"; } @@ -227,7 +229,7 @@ jQuery(document).ready(function () { jQuery("#working_modal").modal("show"); }, success: function(response){ - console.log(response); + //console.log(response); jQuery("#working_modal").modal("hide"); if (response.error){ alert(response.error); -- 2.11.4.GIT