Skip to content

Commit

Permalink
fix home page bubbles if no analytics enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 9, 2024
1 parent 6bd137a commit 9435230
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ def index
@anal_ont_names = []
@anal_ont_numbers = []
if @analytics.empty?
all_metrics = LinkedData::Client::Models::Metrics.all
all_metrics.sort_by{|x| -(x.classes + x.individuals)}[0..4].each do |x|
@anal_ont_names << x.links["ontology"].split('/').last
@anal_ont_numbers << x.classes + x.individuals
@anal_ont_names << x.id.split('/')[-4]
@anal_ont_numbers << (x.classes + x.individuals) || 0
end
else
@analytics.sort_by{|ont, count| -count}[0..4].each do |ont, count|
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/home_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def render_footer_link(options = {})


def format_number_abbreviated(number)
number = 0 if number.nil?

if number >= 1_000_000
(number / 1_000_000).to_s + 'M'
elsif number >= 1_000
Expand Down

0 comments on commit 9435230

Please sign in to comment.