Sfoglia il codice sorgente

Fixed bug where featurelocs weren't showing up if one of the two FK relationships returned NULL

spficklin 12 anni fa
parent
commit
875cddbbcb

+ 4 - 2
tripal_core/api/tripal_core.api.inc

@@ -1720,7 +1720,9 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
  *   a table as single record if only one record exists or to expand as an array if
  *   multiple records exist.
  * @return
- *   A chado object supplemented with the field/table/node requested to be expanded
+ *   A chado object supplemented with the field/table/node requested to be expanded.
+ *   If the type is a table and it has already been expanded no changes is made to the
+ *   returned object
  *
  * Example Usage:
  * @code
@@ -1788,7 +1790,7 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
       
       // don't expand the table it already is expanded
       if(array_key_exists($foreign_table, $object)){
-      	return;
+      	return $object;
       }
       $foreign_table_desc = tripal_core_get_chado_table_schema($foreign_table);
       // If it's connected to the base table

+ 4 - 3
tripal_feature/tripal_feature.module

@@ -1970,6 +1970,7 @@ function tripal_feature_preprocess_tripal_feature_relationships(&$variables) {
   
   // get alignment as child. The $feature->featureloc element
   // is already populated from the alignment preprocess function
+  $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureloc');
   $cfeaturelocs = $feature->featureloc->feature_id;
   if (!$cfeaturelocs) {
      $cfeaturelocs = array();
@@ -2085,9 +2086,9 @@ function tripal_feature_preprocess_tripal_feature_relationships(&$variables) {
 function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
   // we want to provide a new variable that contains the matched features.
   $feature = $variables['node']->feature;
-
+dpm($feature);
   $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureloc');
-  $variables['node']->feature = $feature;
+   dpm($feature); 
   
   // get alignments as child
   $cfeaturelocs = $feature->featureloc->feature_id;
@@ -2109,7 +2110,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
   // get matched alignments (those with an itermediate 'match' or 'EST_match', etc
   $mfeaturelocs = tripal_feature_get_matched_alignments($feature);
   $feature->matched_featurelocs = tripal_feature_get_matched_alignments($feature);
-  
+    
   // combine all three alignments into a single array for printing together in
   // a single list
   $alignments = array();