Live Plugin bug solution

Hi folks!

I’ve worked out a solution that the live plugin shows the correct number of visits and actions in the today’s view.

Due to I have no idea how to use SVN, sorry :frowning: , I’ll provide the solution on my webpage. Hope this is ok?!

schmidhuber.co.at

cheerz,
Alex

Please take a look at the process to submit patches: http://dev.piwik.org/trac/wiki/PiwikDevelo…wtosubmitapatch

Thanks!

Hi Matt,

thanks for the link! I’ll try to stick to the guidelines…

In fact, I believe the problem is in function loadLastVisitorInLastXTimeFromDatabase, in file plugins/Live/API.php. If you look at its source, you’ll see that the parameter $days, which is passed to the function, is never used. Unfortunately, I didn’t managed to solve it, yet…

Although I believe the subject in my previous post should be investigated, I changed the function ajaxTotalVisitors in plugins/Live/Controller.php to this (note the line with $view->visitors):

public function ajaxTotalVisitors($fetch = false)
    {
        $view = Piwik_View::factory('totalVisits');
        $view->idSite = Piwik_Common::getRequestVar('idSite');
        $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30);
        $view->visitorsCountToday = $this->getUsersInLastXDays(1);
        $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30);
        $view->pisToday = $this->getPageImpressionsInLastXDays(1);
        $view->visitors = $this->getLastVisitsStart($fetch);

        $rendered = $view->render($fetch);

        if($fetch)
        {
            return $rendered;
        }
        echo $rendered;
    }