[Slashdotjp-dev 1463] [994] fix journal list bug

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 6日 (金) 20:25:50 JST


Revision: 994
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=994
Author:   tach
Date:     2009-02-06 20:25:50 +0900 (Fri, 06 Feb 2009)

Log Message:
-----------
fix journal list bug

Modified Paths:
--------------
    slashjp/trunk/plugins/Journal/journal_update_slashbox.pl


-------------- next part --------------
Modified: slashjp/trunk/plugins/Journal/journal_update_slashbox.pl
===================================================================
--- slashjp/trunk/plugins/Journal/journal_update_slashbox.pl	2009-02-06 10:18:15 UTC (rev 993)
+++ slashjp/trunk/plugins/Journal/journal_update_slashbox.pl	2009-02-06 11:25:50 UTC (rev 994)
@@ -36,13 +36,15 @@
 		my $where = '1=1';
 		$where .= ' AND tid IN ('.join(',', @$tids).')' if ($skin->{skid} != $constants->{mainpage_skid});
 		next if ($slashdb->sqlCount('journals', $where . ($force ? '' : " AND date > '$block->{last_update}'")) < 1);
+		my $ids = $slashdb->sqlSelectColArrayref('MAX(id) AS jid', 'journals', $where, "GROUP BY uid ORDER BY jid DESC LIMIT $limit");
+		$ids = join(',', @$ids);
 
 		slashdLog("Start updating block \"$name\"") if (verbosity() >= 3);
 		my $result = $slashdb->sqlSelectAllHashrefArray(
-			'nickname AS author,jid,description AS title',
-			'users_journal JOIN users USING (uid) JOIN journals on (users_journal.jid=journals.id)',
-			$where,
-			"ORDER BY users_journal.date DESC LIMIT $limit",
+			'nickname AS author,id AS jid,description AS title',
+			'journals JOIN users USING (uid)',
+			"id IN ($ids)",
+			"ORDER BY date DESC",
 		);
 		map { $_->{'link'} = "$constants->{absolutedir}/~" . strip_paramattr($_->{author}) . "/journal/". $_->{jid} } @$result;
 



Slashdotjp-dev メーリングリストの案内
Back to archive index