Skip to content

Commit

Permalink
Improve handling of missing values
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Dec 5, 2024
1 parent 47d5cd9 commit 9a7c1c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/models/results/dimensional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_max(metric, group = false, member = false)
elsif group && member
rows.filter { |row| row[group.as] == member }.map { |row| row[metric.as] }.compact.max
else
rows.map { |row| row[metric.as] }.compact.max
rows.map { |row| row[metric.as] }.compact.max.blank?
end
end

Expand Down Expand Up @@ -119,7 +119,7 @@ def group_2_unique_members
#
# For example, if the group's dimension is podcast_id, the member will be
# an ID number like 123. This would look for the podcast_name value
# associated with podcast 123, since podcast_name is the exhibiti property
# associated with podcast 123, since podcast_name is the exhibit property
# of podcast_id.

def group_member_label(group, member)
Expand All @@ -141,7 +141,11 @@ def group_member_label(group, member)

# That row will also have the exhibit property value that we're looking
# for
sample_row[prop_as]
exhibit_value = sample_row[prop_as]

# If for some reason the exhibt value did't come back as something
# useful, fallback to the member value
exhibit_value.blank? ? member : exhibit_value
else
member
end
Expand Down

0 comments on commit 9a7c1c3

Please sign in to comment.