Sha256: 95630d5286a183b03e4726adb69e0de496995e569e2302737d01188e1d7a0f3d
Contents?: true
Size: 862 Bytes
Versions: 1
Compression:
Stored size: 862 Bytes
Contents
#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '..', 'lib') require 'setup_environment' require 'observation' require 'stream_wrapper' require 'ansi_colors' require 'set' require 'yaml' filters = { :valid => true, :skip_debug_observations => true } observations = StreamWrapper.open(ARGV, filters) shops = Hash.new do |h,k| h2 = Hash.new(0) h2[:u_items] = Set.new h2[:u_users] = Set.new h[k] = h2 end observations.each do |obs| stats = shops["#{obs[:account_id]}/#{obs[:shop_id]}"] stats[obs.type] += 1 stats[:u_items] << obs[:item_id] if obs[:item_id] stats[:u_users] << obs[:user_id] if obs[:user_id] end shops.each_pair do |k,stats| [:u_items, :u_users].each do |u| stats[u] = stats[u].size end end shops.keys.sort.each do |shop_id| stats = shops[shop_id] puts stats.to_yaml.sub('---', "*** #{shop_id}") end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logbox-0.2.10 | bin/obsstats |