Skip to content

Commit

Permalink
Limit venn diagram in stats to recent distros (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkent authored Aug 19, 2024
1 parent dd89f7e commit e72c8eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions _ruby_libs/pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,23 @@ def initialize(site, package_names, all_repos, errors)
self.data['n_errors'] = errors.length

# compute venn diagram model
distro_counts = Hash[$all_distros.collect { |d| [d, 0] }]
distro_overlaps = Hash[(2..$all_distros.length).flat_map{|n| (0..$all_distros.length-1).to_a.combination(n).to_a}.collect { |s| [s, 0] }]
distro_counts = Hash[$recent_distros.collect { |d| [d, 0] }]
distro_overlaps = Hash[(2..$recent_distros.length).flat_map{|n| (0..$recent_distros.length-1).to_a.combination(n).to_a}.collect { |s| [s, 0] }]

package_names.each do |package_name, package_instances|
overlap = []
#package_instances.snapshots.reject.with_index{|dr, i| dr[1].nil? || dr[1].version.nil? }
package_instances.snapshots.each.with_index do |s,i|
if not s[1].nil? and not s[1].version.nil?
puts "s: " + s.to_s
if not s[1].nil? and not s[1].version.nil? and not distro_counts[s[0]].nil?
overlap << i
distro_counts[s[0]] = distro_counts[s[0]] + 1
end
end

dputs package_name.to_s + " " + overlap.to_s

package_overlaps = (2..$all_distros.length).flat_map{|n| overlap.combination(n).to_a}
package_overlaps = (2..$recent_distros.length).flat_map{|n| overlap.combination(n).to_a}

package_overlaps.each do |o|
distro_overlaps[o] = distro_overlaps[o] + 1
Expand Down
8 changes: 5 additions & 3 deletions js/venn.js/venn.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,11 @@
}
}
}
arcs.push(arc);
arcArea += venn.circleArea(arc.circle.radius, arc.width);
p2 = p1;
if (arc !== null) {
arcs.push(arc);
arcArea += venn.circleArea(arc.circle.radius, arc.width);
p2 = p1;
}
}
} else {
// no intersection points, is either disjoint - or is completely
Expand Down

0 comments on commit e72c8eb

Please sign in to comment.