class VariantBrowseRowPresenter
  def initialize(variant)
    @variant = variant
  end

  def as_json
    {
      entrez_gene: @variant.entrez_name,
      entrez_id: @variant.entrez_id,
      gene_id: @variant.gene_id,
      variant: @variant.name,
      variant_id: @variant.id,
      diseases: @variant.disease_names,
      evidence_item_count: @variant.evidence_item_count,
      assertion_count: @variant.assertion_count,
      drugs: @variant.drug_names,
      civic_actionability_score: @variant.civic_actionability_score,
    }
  end
end

class VariantBrowseRowPresenter
  def initialize(variant)
    @variant = variant
  end

  def as_json
    {
      entrez_gene: @variant.entrez_name,
      entrez_id: @variant.entrez_id,
      gene_id: @variant.gene_id,
      variant: @variant.name,
      variant_id: @variant.id,
      diseases: @variant.disease_names,
      evidence_item_count: @variant.evidence_item_count,
      assertion_count: @variant.assertion_count,
      drugs: @variant.drug_names.compact,
      civic_actionability_score: @variant.civic_actionability_score,
    }
  end
end

Remove nil value from variant's drugs array
Remove nil value from variant's drugs array

The array_agg aggregation function we use in the
app/datatables/variant_browse_table.rb select_query doesn't remove nil
values, which happends for variants that have evidence items that don't
have a drug.
