Ignore:
Timestamp:
Feb 22, 2016, 10:09:57 AM (5 years ago)
Author:
mabarracus
Message:

Fixed bugs: Current month is not displayed, rotation stops when year change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php

    r350 r699  
    6666        function rotate(){
    6767            $sql="select max(fecha) from historico;";
    68             $thismonth=intval(date("m"));
     68            $thismonth=intval(date("Ym"));
    6969            $lastmonth=$thismonth;
    7070            if ($result=$this->dbconn->query($sql)){
     
    7878                        $query->close();
    7979                    }else{
    80                         $lastmonth=intval(explode('-',$row[0])[1]);
     80                        $lastmonth=intval(explode('-',$row[0])[0].explode('-',$row[0])[1]);
    8181                    }
    8282                }
     
    9999                //echo $today.' '.$first_this_month.' '.$first_one_month_ago.' '.$last_one_month_ago.' '.$first_two_month_ago.' '.$last_two_month_ago.' EOL';
    100100                $obj=[];
    101                 $sql="SELECT app,count,fecha from historico where fecha BETWEEN '$first_this_month' and '$today' order by count DESC LIMIT 30";
     101                $sql="SELECT app,count from packages UNION SELECT app,count from historico where fecha BETWEEN '$first_this_month' and '$today' order by count DESC LIMIT 30";
    102102                if ($result=$this->dbconn->query($sql)){
    103103                        $obj2=[];
Note: See TracChangeset for help on using the changeset viewer.