app/helpers/assays_helper.rb
#assays that haven't already been associated with a study
assays that haven't already been associated with a study
assays that haven ' t already been associated with a study
def append_list_assay_organisms assay_organisms
    result=""
    organism=nil
    strain = nil
    culture_growth_type=nil
    organisms =[]
    strains =[]
    culture_growth_types =[]
    tissue_and_cell_types = []
    group_count = 0
    assay_organisms.each do |ao|
      if organism == ao.organism and strain == ao.strain and culture_growth_type == ao.culture_growth_type
        tissue_and_cell_types[group_count].push ao.tissue_and_cell_type
      else
        organism = ao.organism
        strain = ao.strain
        tissue_and_cell_type = ao.tissue_and_cell_type
        culture_growth_type = ao.culture_growth_type
        organisms[group_count] = organism
        strains[group_count] = strain
        culture_growth_types[group_count] = culture_growth_type
        group_count += 1
        tissue_and_cell_types[group_count] =[]
        tissue_and_cell_types[group_count].push(tissue_and_cell_type)
      end
    end
    for group_index in 1..group_count do
      organism = organisms[group_index-1]
      strain = strains[group_index-1]
      culture_growth_type = culture_growth_types[group_index-1]
      one_group_tissue_and_cell_types = tissue_and_cell_types[group_index]
      result += describe_organism_and_strain_for_list(organism, strain)
      if one_group_tissue_and_cell_types.compact.length > 0
        result += " : "
        one_group_tissue_and_cell_types = one_group_tissue_and_cell_types.compact
        one_group_tissue_and_cell_types.each do |tt|
          if tt
            result += " [" if tt== one_group_tissue_and_cell_types.first
            result += link_to h(tt.title), tt
            result += "|" unless tt == one_group_tissue_and_cell_types.last
            result += "]" if tt == one_group_tissue_and_cell_types.last
          end
        end
      end
      if culture_growth_type
        result += " (#{culture_growth_type.title})"
      end
      result += ", " unless group_index==group_count
    end
    return result.html_safe
  end
def append_list_assay_organisms assay_organisms result = "" organism = nil strain = nil culture_growth_type = nil organisms = [ ] strains = [ ] culture_growth_types = [ ] tissue_and_cell_types = [ ] group_count = 0 assay_organisms . each do | ao | if organism == ao . organism and strain == ao . strain and culture_growth_type == ao . culture_growth_type tissue_and_cell_types [ group_count ] . push ao . tissue_and_cell_type else organism = ao . organism strain = ao . strain tissue_and_cell_type = ao . tissue_and_cell_type culture_growth_type = ao . culture_growth_type organisms [ group_count ] = organism strains [ group_count ] = strain culture_growth_types [ group_count ] = culture_growth_type group_count += 1 tissue_and_cell_types [ group_count ] = [ ] tissue_and_cell_types [ group_count ] . push ( tissue_and_cell_type ) end end for group_index in 1 .. group_count do organism = organisms [ group_index - 1 ] strain = strains [ group_index - 1 ] culture_growth_type = culture_growth_types [ group_index - 1 ] one_group_tissue_and_cell_types = tissue_and_cell_types [ group_index ] result += describe_organism_and_strain_for_list ( organism , strain ) if one_group_tissue_and_cell_types . compact . length > 0 result += " : " one_group_tissue_and_cell_types = one_group_tissue_and_cell_types . compact one_group_tissue_and_cell_types . each do | tt | if tt result += " [" if tt == one_group_tissue_and_cell_types . first result += link_to h ( tt . title ) , tt result += "|" unless tt == one_group_tissue_and_cell_types . last result += "]" if tt == one_group_tissue_and_cell_types . last end end end if culture_growth_type result += " (#{culture_growth_type.title})" end result += ", " unless group_index == group_count end return result . html_safe end
assays that haven't already been associated with a study
assays that haven ' t already been associated with a study
assay_organisms