From 4c8f79b699dce10518e7348b72133bfaa6eab12b Mon Sep 17 00:00:00 2001 From: liyun Date: Mon, 29 Jul 2013 10:53:27 +0800 Subject: [PATCH 1/2] show the most 10 version --- .../models/product/versionmodel.php | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/web/application/models/product/versionmodel.php b/web/application/models/product/versionmodel.php index d863a1bc..6c48927e 100644 --- a/web/application/models/product/versionmodel.php +++ b/web/application/models/product/versionmodel.php @@ -99,7 +99,24 @@ function getVersionData($fromTime,$toTime,$productid) from ".$dwdb->dbprefix('dim_product')." pp where pp.product_id =$productid and pp.product_active=1 and pp.channel_active=1 - and pp.version_active=1 + and pp.version_active=1 + and pp.version_name in (select + version_name + from + (select + sum(startusers), version_name + from + razor_sum_basic_product_version + where + date_sk in (select + date_sk + from + razor_dim_date + where + datevalue between '$fromTime' and '$toTime') + group by version_name + order by sum(startusers) desc + limit 10) rs) group by pp.version_name) p left join (select * from ".$dwdb->dbprefix('sum_basic_product_version')." @@ -232,4 +249,4 @@ function getNewAndActiveAllCount($productId,$from,$to) } -?> \ No newline at end of file +?> From 17381e6f9db2f260b060098b4ba9a8173ff1b570 Mon Sep 17 00:00:00 2001 From: liyun Date: Mon, 29 Jul 2013 11:42:29 +0800 Subject: [PATCH 2/2] filter none session version --- web/application/models/product/versionmodel.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/application/models/product/versionmodel.php b/web/application/models/product/versionmodel.php index 6c48927e..1ca228b0 100644 --- a/web/application/models/product/versionmodel.php +++ b/web/application/models/product/versionmodel.php @@ -45,11 +45,12 @@ function getBasicVersionInfo($productId,$date) and s.product_id = $productId and p.product_id = s.product_id and p.product_active=1 - and p.channel_active=1 + and p.channel_active=1 + and s.session >0 and p.version_active=1 and p.version_name=s.version_name group by p.version_name) t - right join + left join ( select distinct pp.version_name from ".$dwdb->dbprefix('dim_product')." pp where pp.product_id = $productId