From: Jacek K. <j_k...@us...> - 2005-01-25 13:53:33
|
Update of /cvsroot/wonder/Wonder/Utilities/WOLogging/Analysis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20061 Modified Files: Miner.rb StatModules.rb Log Message: conversion statistics added Index: Miner.rb =================================================================== RCS file: /cvsroot/wonder/Wonder/Utilities/WOLogging/Analysis/Miner.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Miner.rb 28 Sep 2004 09:38:58 -0000 1.1 --- Miner.rb 25 Jan 2005 13:53:14 -0000 1.2 *************** *** 30,39 **** def add_statistics( class_desc, title ) ! #puts("Adding '#{class_desc}'") ! $stats.push( STAT_NAME_MAPPINGS[class_desc].new( title,$log_manager ) ) end Object.send(:alias_method, :AddStatistics, :add_statistics ) ! def parse_args() --- 30,42 ---- def add_statistics( class_desc, title ) ! add_statistics_with_params( class_desc, title, nil ) end + def add_statistics_with_params( class_desc, title, args ) + $stats.push( STAT_NAME_MAPPINGS[class_desc].new( title,args,$log_manager ) ) + end + Object.send(:alias_method, :AddStatistics, :add_statistics ) ! Object.send(:alias_method, :AddStatisticsWithParams, :add_statistics_with_params ) def parse_args() Index: StatModules.rb =================================================================== RCS file: /cvsroot/wonder/Wonder/Utilities/WOLogging/Analysis/StatModules.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StatModules.rb 28 Sep 2004 09:38:58 -0000 1.1 --- StatModules.rb 25 Jan 2005 13:53:15 -0000 1.2 *************** *** 6,10 **** attr_accessor :result_hash, :title ! def initialize( title, log_manager ) puts(" + Initializing stat module: "+self.class.to_s) @title = title --- 6,10 ---- attr_accessor :result_hash, :title ! def initialize( title, args, log_manager ) puts(" + Initializing stat module: "+self.class.to_s) @title = title *************** *** 68,73 **** class PageStatModule < StatModule ! def initialize( title, log_manager ) ! super( title, log_manager ) @type = POS_PAGE_NAME @treshold = 1 --- 68,73 ---- class PageStatModule < StatModule ! def initialize( title, args, log_manager ) ! super( title, args, log_manager ) @type = POS_PAGE_NAME @treshold = 1 *************** *** 119,127 **** class SessionTrackStatModule < StatModule ! def initialize( title, log_manager ) ! super( title, log_manager ) @type = POS_SESSION_ID @tmp_hash = Hash.new @treshold = 1 end --- 119,132 ---- class SessionTrackStatModule < StatModule ! def initialize( title, args, log_manager ) ! super( title, args, log_manager ) @type = POS_SESSION_ID @tmp_hash = Hash.new + @conv_hash = Hash.new @treshold = 1 + @conv_pages = nil + if args!=nil && args.length>0 + @conv_pages = args[0].split(/,/) + end end *************** *** 136,139 **** --- 141,173 ---- @tmp_hash[ track_string ] = Array [ 1, Array[ record.info[POS_SESSION_ID] ] ] end + + + if @conv_pages + n = record + i = 0 + milestone_page = nil + prev_page = nil + current_page = nil + while n != nil && i < @conv_pages.length + prev_page = current_page + milestone_page = @conv_pages[i] + current_page = n.info[POS_PAGE_NAME] + #puts("* #{current_page}<=>#{milestone_page}") + if current_page == milestone_page + #puts(" * prev: #{prev_page}, #{current_page}") + if (prev_page != current_page) + if @conv_hash[milestone_page]!=nil + #puts("incrementing for page #{milestone_page}: #{@conv_hash[milestone_page]}") + @conv_hash[milestone_page]=@conv_hash[milestone_page]+1 + else + #puts("putting 1 for page #{milestone_page}") + @conv_hash[milestone_page]=1 + end + i=i+1 + end + end + n = n.next[ @type ] + end + end # if @conv_pages available } *************** *** 152,155 **** --- 186,213 ---- end } + + if @conv_pages + current_array = Array.new + @result_hash["Conversion"] = current_array + prev_value = nil + first_value = nil + current_array.push( [ "Page name", "Occurances", "LCR", "GCR" ] ) + @conv_hash.keys.sort { |k1,k2| @conv_hash[k2] <=> @conv_hash[k1] }.each { |page| + value = @conv_hash[page] + lcr ="--" + if prev_value + lcr = (value.to_f / prev_value.to_f * 1000).to_i / 10 + end + gcr = "--" + if first_value + gcr = (value.to_f / first_value.to_f * 1000).to_i / 10 + end + current_array.push( [ page, value, "#{lcr} %%", "#{gcr} %%" ] ) + prev_value = value + if first_value==nil + first_value = value + end + } + end # if conv_pages available end |