Skip to content

Commit

Permalink
v0.3.1
Browse files Browse the repository at this point in the history
fix some display error
  • Loading branch information
cobub committed Nov 29, 2012
1 parent 7bc3089 commit 2d0d8cd
Show file tree
Hide file tree
Showing 17 changed files with 362 additions and 118 deletions.
19 changes: 11 additions & 8 deletions web/application/controllers/manage/alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ function index()
$this->load->view ( 'manage/productAlert',$data);
}

function editAlert($lab,$condition)
function editAlert($id,$condition)
{
$this->common->loadHeader();
$data['alertlist'] = $this->alert->getalertbyid($lab,$condition);
$data['alertlist'] = $this->alert->getalertbyid($id,$condition);
$this->load->view('manage/editalert',$data);
}

Expand All @@ -48,11 +48,11 @@ function addalertlab()

$product = $this->common->getCurrentProduct();
$productId = $product->id;
echo $productId;
// echo $productId;
$exceptionlab = $_POST['exceptionlab'];
$condition = $_POST['condition'];
$emalstr = $_POST['emailstr'];
$isUnique=$this->alert->isUnique($exceptionlab,$condition);
$isUnique=$this->alert->isUnique($exceptionlab,$condition,$emalstr);
if(count($isUnique->result_array())>=1){
echo false;
}else{
Expand All @@ -61,9 +61,9 @@ function addalertlab()
}
}

function delAlert($label)
function delAlert($id,$condition)
{
$this->alert->delalert($label);
$this->alert->delalert($id,$condition);
$this->index();
}

Expand All @@ -73,11 +73,14 @@ function startAlert($id)
$this->index();
}

function resetalertlab($id)
function resetalertlab()
{
// $product = $this->common->getCurrentProduct();
$Id = $_POST['id'];
$exceptionlab = $_POST['exceptionlab'];
$condition = $_POST['condition'];
$this->alert->resetalert($exceptionlab,$condition);
$emails = $_POST['emailstr'];
$this->alert->resetalert($Id,$exceptionlab,$condition,$emails);
// $this->index();
}

Expand Down
14 changes: 13 additions & 1 deletion web/application/controllers/report/funnels.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ function prepareConversionData($targetdata=array(),$eventdata=array()){
function prepareUnitAndeventCount($targetdata=array(),$eventdata=array()){
$result=array();
$date=array();
$sc_arr=array();
$unitprices=array();
$fromTime = $this->common->getFromTime ();
$toTime = $this->common->getToTime ();
$datelist=$this->common->getDateList($fromTime,$toTime);
//all event count
for($d=0;$d<count($datelist);$d++){
$count=0;
$scount=0;
$unitprice=0;
for($i = 0; $i < count ( $targetdata ); $i ++) {
$target = $targetdata [$i];
Expand All @@ -96,21 +98,31 @@ function prepareUnitAndeventCount($targetdata=array(),$eventdata=array()){
if ($target ['eid'] == $event ['event_id']) {
$date_array=explode(" ", $event['datevalue']);
$k='';
$bool=false;
if($datelist[$d]==$date_array[0]){
$count+=$event ['num'];
$unitprice+=$event ['num']*($target['unitprice']);
}else{
$count+=0;
}
}
if ($target ['sid'] == $event ['event_id']) {
$date_array=explode(" ", $event['datevalue']);
$k='';
if($datelist[$d]==$date_array[0]){
$scount+=$event ['num'];
}else{
$scount+=0;
}
}
}
}
$sc_arr[$datelist[$d]]=$scount;
$date[$datelist[$d]]=$count;
$unitprices[0][$datelist[$d]]=$unitprice;
}
$result['unitprice']=$unitprices;
$result['date']=$date;
$result['scount']=$sc_arr;
return $result;
}
/*load funnel report*/
Expand Down
19 changes: 12 additions & 7 deletions web/application/controllers/report/productbasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,18 @@ function getTypeAnalyzeData($timePhase,$fromDate='',$toDate='') {
function addphaseusetimereport($delete=null,$type=null)
{
$productId = $this->common->getCurrentProduct();
if($delete==null)
{
$this->data['add']="add";
}
if($delete=="del")
{
$this->data['delete']="delete";
if(!empty($productId)){
if($delete==null){
$this->data['add']="add";
}
if($delete=="del"){
$this->data['delete']="delete";
}
}else{
$products=$this->common->getCompareProducts();
if(empty($products)){
$this->common->requireProduct();
}
}
if($type!=null)
{
Expand Down
34 changes: 17 additions & 17 deletions web/application/language/en_US/allview_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
$lang['m_rpt_carriers']='Carriers';
$lang['m_rpt_networking']='Networking';
$lang['m_rpt_events']='Events & Conversion';
$lang['m_rpt_eventlist']='Event List';
$lang['m_rpt_eventlist']='Annotations List';
$lang['m_rpt_errors']='Errors';
$lang['m_rpt_errorsOfVersion']='Errors of Version';
$lang['m_rpt_errorsOnOS']='Errors on OS';
Expand Down Expand Up @@ -485,24 +485,24 @@
$lang['v_man_ev_errorInputEN']='The input value of event name is illegal!';

//view---manage---exception
$lang['v_man_ev_productalter']='Custom Smart Notification tag';
$lang['v_man_ev_productAlertList']='Smart Notification label list';
$lang['v_man_ev_addAlertlab']='Add Smart Notification tag';
$lang['v_rpt_el_alertlab']='Smart Notification tag';
$lang['v_man_ev_modifyAlertlab']='Modify Smart Notification tag';
$lang['v_rpt_el_condition']='Range';
$lang['v_man_ev_editalertlab']='Abnormal label editor';
$lang['v_rpt_el_add']='add';
$lang['v_man_ev_productalter']='Smart Notification';
$lang['v_man_ev_productAlertList']='Smart Notification list';
$lang['v_man_ev_addAlertlab']='Add Smart Notification';
$lang['v_rpt_el_alertlab']='Smart Notification';
$lang['v_man_ev_modifyAlertlab']='Modify Smart Notification';
$lang['v_rpt_el_condition']='Deviation';
$lang['v_man_ev_editalertlab']='Action';
$lang['v_rpt_el_add']='Add';
$lang['v_rpt_el_set']='set';
$lang['v_rpt_el_email']='E-mail';
$lang['v_rpt_el_note']='More than one email address please separate by ;';
$lang['v_rpt_el_note']='please input your email, multiple emails seperated by \' ; \'';
$lang['v_rpt_el_noteofemail']='Please enter at least one e-mail address';
$lang['v_rpt_el_noteofcondition']='Please enter reminded range';
$lang['v_rpt_addlab']='Add Smart Notification...';
$lang['v_rpt_addok']='Add completed';


$lang['emailtext']="Dear Cobub Razor User,<br><br>
$lang['emailtext']="Dear Cobub Razor User:<br><br>
The mobile app %s‘s data volatility exceed the expectation on %s:<br>
Data Type: %s<br>
Expand Down Expand Up @@ -582,7 +582,7 @@
$lang ['v_rpt_re_funnelStepadd'] = "Add Step";
$lang ['v_rpt_re_funnelTarget'] = "Target";
$lang ['v_rpt_re_funnelName'] = "Target Name";
$lang['v_rpt_re_unitprice']='Money';
$lang['v_rpt_re_unitprice']='Value';
$lang['v_rpt_re_unitprice_alt']='Please input the Current Money';
$lang ['v_rpt_re_funnelStartevent'] = "Start Event";
$lang ['v_rpt_re_funnelTargetevent'] = "Target Event";
Expand Down Expand Up @@ -794,16 +794,16 @@
/***************************************markevent**********************************************/
$lang['m_title']='Title';
$lang['m_description']='Description';
$lang['m_marktime']='Annotation Date';
$lang['m_marktime']='Date';
$lang['m_rights']='Rights';
$lang['m_submit']='Submit';
$lang['m_public']='Public';
$lang['m_private']='Private';
$lang['m_operate']='Operate';
$lang['m_operate']='Action';
$lang['m_newsreport']='Annotation Edit';
$lang['m_modify']='Modify Info';
$lang['m_delete']='Delete';
$lang['m_isdel']='is Delete?';
$lang['m_isdel']='Are you sure to delete?';
$lang['m_waittingdel']='Waitting ……';
$lang['m_delsuccess']='Delete success';
$lang['m_errordeltryagain']='Error delete,Please try again a later';
Expand All @@ -816,11 +816,11 @@
$lang['m_markeventlist']='Mark events List';
$lang['m_user']='Mark User';
$lang['m_eventsDetail']='Event Detail';
$lang['m_dateevents']='Annotation Event';
$lang['m_dateevents']='Annotations';
$lang['m_viewmark_Detail']='View Detail';
/*****************************Compare Product*****************************************/
$lang['c_compare_product']='Compare Product';
$lang['c_compare2two4']='The selected Num between 2-4';
$lang['c_compare2two4']='Please select 2-4 products';
/*********************************Suspended box*************************************/
$lang['s_suspend_title']='Pin to dashboard';
$lang['s_suspend_deltitle']='Delete to dashboard';
16 changes: 8 additions & 8 deletions web/application/language/zh_CN/allview_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,13 @@
$lang['v_man_ev_errorInputEN']='输入的事件名称不合法!';

//view---manage---exception
$lang['v_man_ev_productalter']='自定义智能提醒标签';
$lang['v_man_ev_productAlertList']='智能提醒标签列表';
$lang['v_man_ev_addAlertlab']='添加智能提醒标签';
$lang['v_rpt_el_alertlab']='智能提醒标签';
$lang['v_man_ev_productalter']='自定义智能提醒';
$lang['v_man_ev_productAlertList']='智能提醒列表';
$lang['v_man_ev_addAlertlab']='添加智能提醒';
$lang['v_rpt_el_alertlab']='智能提醒';
$lang['v_man_ev_modifyAlertlab']='修改智能提醒提示';
$lang['v_rpt_el_condition']='范围';
$lang['v_man_ev_editalertlab']='编辑智能提醒标签';
$lang['v_man_ev_editalertlab']='操作';
$lang['v_rpt_el_add']='添加';
$lang['v_rpt_el_set']='修改';
$lang['v_rpt_el_email']='接收邮箱';
Expand Down Expand Up @@ -795,7 +795,7 @@
/***************************************markevent**********************************************/
$lang['m_title']='标题';
$lang['m_description']='描述';
$lang['m_marktime']='标记日期';
$lang['m_marktime']='标注日期';
$lang['m_rights']='权限';
$lang['m_submit']='提交信息';
$lang['m_public']='公共';
Expand All @@ -814,8 +814,8 @@
$lang['m_subsuccess']='添加成功';
$lang['m_modifysuccess']='修改成功';
$lang['m_changesubtomodify']='信息已經存在!你確定要修改嗎?';
$lang['m_markeventlist']='标记事件列表';
$lang['m_user']='标记用户';
$lang['m_markeventlist']='标注事件列表';
$lang['m_user']='标注用户';
$lang['m_eventsDetail']='事件详细';
$lang['m_dateevents']='标注事件';
$lang['m_viewmark_Detail']='点击查看详细';
Expand Down
21 changes: 11 additions & 10 deletions web/application/models/alert/alertmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ function getProductAlertByProuctId($productId)
return $result;
}

function isUnique($exceptionlab,$condition){
function isUnique($exceptionlab,$condition,$emails){
$product = $this->common->getCurrentProduct();
$id = $product->id;
$sql ="select * from ".$this->db->dbprefix('alert')." a where a.productid=$id and a.label='".$exceptionlab."' and a.condition='".$condition."'; ";
$sql ="select * from ".$this->db->dbprefix('alert')." a where a.productid=$id and a.emails='".$emails."' and a.label='".$exceptionlab."' and a.condition='".$condition."' ; ";
$result = $this->db->query($sql);
return $result;

Expand All @@ -40,13 +40,13 @@ function addlab($exceptionlab,$condition,$emailstr)
$userId = $this->common->getUserId();
$product = $this->common->getCurrentProduct();
$data = array('label' => $exceptionlab,'condition'=>$condition,'productid'=>$product->id,'userid'=>$userId,'emails'=>$emailstr);
echo $this->db->insert('alert',$data);
$this->db->insert('alert',$data);
}
function getalertbyid($lab,$condition)
function getalertbyid($id,$condition)
{
$sql ="SELECT *
FROM ".$this->db->dbprefix('alert')."
WHERE label = '".$lab."'
WHERE id = '".$id."'
AND active =1
AND abs(`condition` -".$condition.")<0.001";
// $sql = "select * from ".$this->db->dbprefix('alert')." where label ='".$lab."' and active=1 and condition =".$condition.";";
Expand All @@ -58,19 +58,20 @@ function getalertbyid($lab,$condition)
return null;
}

function delalert($label)
function delalert($id,$condition)
{

$sql = "delete from ".$this->db->dbprefix('alert')." where label='".$label."'";
$sql = "delete from ".$this->db->dbprefix('alert')." where id='".$id."' and `condition`=$condition ";
$this->db->query($sql);

}


function resetalert($label,$condition)
function resetalert($Id,$label,$condition,$emails)
{
$sql=" update ".$this->db->dbprefix('alert')." set `condition`=$condition where `label`='".$label."'";
echo $sql;
$sql ="UPDATE ".$this->db->dbprefix('alert')." SET `condition`=$condition,`label`='$label',`emails`='$emails' WHERE `id`=$Id";
// $sql=" update ".$this->db->dbprefix('alert')." set `condition`=$condition,`label`=$label,`emails`=$emails where `id`=".$productId."";
// echo $sql;
$this->db->query($sql);
}
}
3 changes: 1 addition & 2 deletions web/application/models/event/userevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ function isUnique($productId,$event_id){
$this->db->from('event_defination');
$this->db->where('product_id',$productId);
$this->db->where('event_identifier',$event_id);
$this->db->where('active','1');
$r = $this->db->get();
return $r->result();

Expand All @@ -148,7 +147,7 @@ function addEvent($event_id,$event_name)
//Through eventid get event information
function geteventbyid($eventid)
{
$sql = "select event_id ,event_identifier,event_name from ".$this->db->dbprefix('event_defination')." where event_id =$eventid and active=1";
$sql = "select event_id ,event_identifier,event_name from ".$this->db->dbprefix('event_defination')." where event_id =$eventid";
$result = $this->db->query($sql);
if($result!=null&&$result->num_rows()>0)
{
Expand Down
17 changes: 9 additions & 8 deletions web/application/models/product/errormodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function __construct() {

//get error count and count/sessions data by version
function geterroralldata($productId,$fromTime,$toTime) {
$dwdb = $this->load->database ( 'dw', TRUE );
$dwdb = $this->load->database ( 'dw', TRUE );
$sql="Select
p.version_name,
ifnull(count(f.id),0) errorcount,
ifnull(count(f.id)/(select sum(sessions) from ".$dwdb->dbprefix('sum_basic_all')." s,".$dwdb->dbprefix('dim_date')." sd, ".$dwdb->dbprefix('dim_product')." sp where s.date_sk =sd.date_sk and sd.datevalue between '$fromTime' and '$toTime' and s.product_sk = sp.product_sk and sp.product_id='$productId'),0) percentage
from ".$dwdb->dbprefix('fact_errorlog')." f, ".$dwdb->dbprefix('dim_date')." d, ".$dwdb->dbprefix('dim_product')." p where f.date_sk = d.date_sk and d.datevalue between '$fromTime' and '$toTime' and f.product_sk = p.product_sk and p.product_id = $productId and p.product_active=1 and p.channel_active=1 and p.version_active=1";

ifnull(count(f.id)/(select sum(sessions) from ".$dwdb->dbprefix('sum_basic_all')." s,".$dwdb->dbprefix('dim_date')." sd, ".$dwdb->dbprefix('dim_product')." sp where s.date_sk =sd.date_sk and sd.datevalue between '$fromTime' and '$toTime' and s.product_sk = sp.product_sk and sp.product_id='$productId' and sp.version_name=p.version_name),0) percentage
from ".$dwdb->dbprefix('fact_errorlog')." f, ".$dwdb->dbprefix('dim_date')." d, ".$dwdb->dbprefix('dim_product')." p where f.date_sk = d.date_sk and d.datevalue between '$fromTime' and '$toTime' and f.product_sk = p.product_sk and p.product_id = $productId and p.product_active=1 and p.channel_active=1 and p.version_active=1 group by p.version_name order by version_name";
$query= $dwdb->query ($sql);
$ret=array();
if ($query != null && $query->num_rows() > 0) {
Expand All @@ -39,6 +39,7 @@ function geterroralldata($productId,$fromTime,$toTime) {
$row = $array[$i];
$tmp ['count'] = $row ['errorcount'];
$tmp ['percentage'] = round($row ['percentage'],2);
$tmp ['version_name'] = $row ['version_name'];
array_push ( $content_arr, $tmp );
}
$ret['content'] = $content_arr;
Expand Down Expand Up @@ -118,10 +119,10 @@ function getErrorAllDataOnOs($productId,$fromTime,$toTime) {
function getErrorAllDataOnDevice($productId,$fromTime,$toTime) {
$dwdb = $this->load->database ( 'dw', TRUE );
$sql="Select
o.devicebrand_name,
ifnull(count(f.id),0) errorcount,
ifnull(count(f.id)/(select count(*) from ".$dwdb->dbprefix('fact_clientdata')." s,".$dwdb->dbprefix('dim_date')." sd, ".$dwdb->dbprefix('dim_product')." sp where s.date_sk =sd.date_sk and sd.datevalue between '$fromTime' and '$toTime' and s.product_sk = sp.product_sk and sp.product_id=$productId and s.devicebrand_sk=o.devicebrand_sk),0) percentage
from ".$dwdb->dbprefix('fact_errorlog')." f, ".$dwdb->dbprefix('dim_date')." d, ".$dwdb->dbprefix('dim_product')." p, ".$dwdb->dbprefix('dim_devicebrand')." o where f.date_sk = d.date_sk and d.datevalue between '$fromTime' and '$toTime' and f.product_sk = p.product_sk and p.product_id = $productId and p.product_active=1 and p.channel_active=1 and p.version_active=1 and f.deviceidentifier = o.devicebrand_sk group by o.devicebrand_name order by errorcount desc
o.devicebrand_name,
ifnull(count(f.id),0) errorcount,
ifnull(count(f.id)/(select count(*) from ".$dwdb->dbprefix('fact_clientdata')." s,".$dwdb->dbprefix('dim_date')." sd, ".$dwdb->dbprefix('dim_product')." sp where s.date_sk =sd.date_sk and sd.datevalue between '$fromTime' and '$toTime' and s.product_sk = sp.product_sk and sp.product_id=$productId and s.devicebrand_sk=o.devicebrand_sk),0) percentage
from ".$dwdb->dbprefix('fact_errorlog')." f, ".$dwdb->dbprefix('dim_date')." d, ".$dwdb->dbprefix('dim_product')." p, ".$dwdb->dbprefix('dim_devicebrand')." o where f.date_sk = d.date_sk and d.datevalue between '$fromTime' and '$toTime' and f.product_sk = p.product_sk and p.product_id = $productId and p.product_active=1 and p.channel_active=1 and p.version_active=1 and f.deviceidentifier = o.devicebrand_sk group by o.devicebrand_name order by errorcount desc
limit 0,".REPORT_TOP_TEN;

$query= $dwdb->query ($sql);
Expand Down
Loading

0 comments on commit 2d0d8cd

Please sign in to comment.