[Cpan-forum-commit] rev 294 - in trunk: . lib/CPAN/Forum/DB lib/CPAN/Forum/RM templates
svn at pti.co.il
svn at pti.co.il
Sun Jul 22 07:02:33 EEST 2007
Author: gabor
Date: 2007-07-22 07:02:32 +0300 (Sun, 22 Jul 2007)
New Revision: 294
Modified:
trunk/
trunk/lib/CPAN/Forum/DB/Tags.pm
trunk/lib/CPAN/Forum/RM/Other.pm
trunk/templates/stats.tmpl
Log:
list top users based on number of tags
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4301
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
+ 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4302
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
Modified: trunk/lib/CPAN/Forum/DB/Tags.pm
===================================================================
--- trunk/lib/CPAN/Forum/DB/Tags.pm 2007-07-22 04:02:13 UTC (rev 293)
+++ trunk/lib/CPAN/Forum/DB/Tags.pm 2007-07-22 04:02:32 UTC (rev 294)
@@ -145,4 +145,18 @@
=cut
+sub stat_tags_by_user {
+ my ($self, $limit) = @_;
+ my $sql = qq{
+ SELECT COUNT(*) cnt, users.username username
+ FROM tag_cloud,users
+ WHERE tag_cloud.uid=users.id
+ GROUP BY username
+ ORDER BY cnt DESC
+ LIMIT ?
+ };
+ return $self->_fetch_arrayref_of_hashes($sql, $limit);
+}
+
+
1;
Modified: trunk/lib/CPAN/Forum/RM/Other.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Other.pm 2007-07-22 04:02:13 UTC (rev 293)
+++ trunk/lib/CPAN/Forum/RM/Other.pm 2007-07-22 04:02:32 UTC (rev 294)
@@ -41,15 +41,19 @@
my $t = $self->load_tmpl("stats.tmpl");
my $modules_cnt = 50;
my $groups = CPAN::Forum::DB::Posts->stat_posts_by_group($modules_cnt); # SQL
+ $t->param(modules_cnt => $modules_cnt);
+ $t->param(groups => $groups);
+
my $users_cnt = 50;
my $top_users = CPAN::Forum::DB::Posts->stat_posts_by_user($users_cnt); # SQL
- #
- # TODO: user stats removed as it was extreamly slow..
- #
- $t->param(modules_cnt => $modules_cnt);
- $t->param(groups => $groups);
$t->param(users_cnt => $users_cnt);
$t->param(users => $top_users);
+
+ my $tagging_users_cnt = 10;
+ my $top_tagging_users = CPAN::Forum::DB::Tags->stat_tags_by_user($tagging_users_cnt); # SQL
+ $t->param(tagging_users_cnt => $tagging_users_cnt);
+ $t->param(tagging_users => $top_tagging_users);
+
$t->output;
}
Modified: trunk/templates/stats.tmpl
===================================================================
--- trunk/templates/stats.tmpl 2007-07-22 04:02:13 UTC (rev 293)
+++ trunk/templates/stats.tmpl 2007-07-22 04:02:32 UTC (rev 294)
@@ -4,25 +4,48 @@
<TMPL_INCLUDE NAME="navigation.tmpl">
<a name="statistics"></a>
+<table>
+<tr><td>
+
<div class="about_list">
-<p class="about_title">Top <TMPL_VAR modules_cnt> modules (number of posts)</p>
+<p class="about_title">Top <TMPL_VAR modules_cnt> modules<br />(number of posts)</p>
<table>
<TMPL_LOOP groups>
<tr><td><a href="/dist/<TMPL_VAR gname>"><TMPL_VAR gname></a></td><td><TMPL_VAR cnt></td></tr>
</TMPL_LOOP>
</table>
</div>
+</td>
<TMPL_IF users>
+<td>
<div class="about_list">
- <p class="about_title"><TMPL_VAR users_cnt> most active users (number of posts)</p>
+ <p class="about_title"><TMPL_VAR users_cnt> most active users<br />(number of posts)</p>
<table>
<TMPL_LOOP users>
<tr><td><a href="/users/<TMPL_VAR username>"><TMPL_VAR username></a></td><td><TMPL_VAR cnt></td></tr>
</TMPL_LOOP>
</table>
</div>
+</td>
</TMPL_IF>
+
+<TMPL_IF tagging_users>
+<td valign=top>
+ <div class="about_list">
+ <p class="about_title"><TMPL_VAR tagging_users_cnt> most active users<br />(number of tags)</p>
+ <table>
+ <TMPL_LOOP tagging_users>
+ <tr><td><a href="/users/<TMPL_VAR username>"><TMPL_VAR username></a></td><td><TMPL_VAR cnt></td></tr>
+ </TMPL_LOOP>
+ </table>
+ </div>
+</td>
+</TMPL_IF>
+
+
+</tr>
+</table>
<TMPL_INCLUDE NAME="footer.tmpl">
More information about the Cpan-forum-commit
mailing list