[pLog-svn] r4642 - plog/branches/lifetype-1.1.5/class/summary/dao

BalearWeb balearweb at balearweb.com
Thu Feb 1 05:05:30 EST 2007


Jordi, from blocat.com, is using this:

$query = "SELECT SUM(((a.num_reads + a.num_comments/5) /
(TO_DAYS(NOW()) - TO_DAYS(a.date) + 1)) )/COUNT(a.id) as rank,
                      b.id AS blog_id, b.blog
                     FROM {$prefix}articles AS a
                     INNER JOIN {$prefix}blogs AS b
                     ON b.id = a.blog_id AND b.status = 
".BLOG_STATUS_ACTIVE."
                     WHERE a.date >= ".$this->_startTime." AND a.date
<= ".$this->_now."
                      AND a.in_summary_page = '1'
                      AND b.show_in_summary = '1'
                      GROUP BY b.id
                     ORDER BY rank DESC"; 

I still haven't tried. I will give it a try this afternoon. 

oscar at devel.lifetype.net wrote:
> Author: oscar
> Date: 2007-02-01 04:34:44 -0500 (Thu, 01 Feb 2007)
> New Revision: 4642
>
> Modified:
>    plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php
> Log:
> reverted the mostActiveBlogs() changes until we find another solution, since they did not seem to work very well
>
>
> Modified: plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php
> ===================================================================
> --- plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php	2007-02-01 00:12:11 UTC (rev 4641)
> +++ plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php	2007-02-01 09:34:44 UTC (rev 4642)
> @@ -179,13 +179,16 @@
>  			include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
>  		 
>  			$prefix = $this->getPrefix();
> -            $query = "SELECT id, num_posts, last_update_date FROM {$prefix}blogs
> -                      WHERE show_in_summary = '1'
> -					  AND last_update_date >= ".$this->_startTime." AND last_update_date <= ".$this->_now."
> -					  AND status = ".BLOG_STATUS_ACTIVE." AND
> -					  last_update_date > create_date
> -					  ORDER BY last_update_date DESC, num_posts DESC";
> -					
> +            $query = "SELECT COUNT(a.id) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) + 1)) ) as rank, b.id AS blog_id
> +                      FROM {$prefix}articles AS a
> +                      INNER JOIN {$prefix}blogs AS b 
> +                      ON b.id = a.blog_id AND b.status = ".BLOG_STATUS_ACTIVE."
> +                      WHERE a.date >= ".$this->_startTime." AND a.date <= ".$this->_now." 
> +					  AND in_summary_page = '1' 
> +					  AND b.show_in_summary = '1'
> +					  GROUP BY a.id
> +                      ORDER BY rank DESC";
> +
>              if( $maxBlogs > 0 )
>              	$query .= " LIMIT 0,".$maxBlogs;
>              else
> @@ -200,7 +203,7 @@
>              $blogs = Array();
>  			$blogsDao = new Blogs();
>              while( $row = $result->FetchRow()) {
> -                $blog = $blogsDao->getBlogInfo( $row["id"] );
> +                $blog = $blogsDao->getBlogInfo( $row["blog_id"] );
>                  $blogs[$blog->getId()] = $blog;
>              }
>              
>   



More information about the pLog-svn mailing list