[Cpan-forum-commit] rev 335 - in trunk: . lib/CPAN

svn at pti.co.il svn at pti.co.il
Tue Aug 14 11:32:35 EEST 2007


Author: gabor
Date: 2007-08-14 11:32:35 +0300 (Tue, 14 Aug 2007)
New Revision: 335

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
Log:
collect list of responses from the already selected posts



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4421
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4422
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2007-08-14 08:32:22 UTC (rev 334)
+++ trunk/lib/CPAN/Forum.pm	2007-08-14 08:32:35 UTC (rev 335)
@@ -1271,7 +1271,9 @@
 
 sub _post {
     my ($self, $post) = @_;
-    my $responses = CPAN::Forum::DB::Posts->list_posts_by(parent => $post->{id}); # SQL
+    my $responses = $post->{responses} || CPAN::Forum::DB::Posts->list_posts_by(parent => $post->{id}); # SQL
+    $self->log->debug(Data::Dumper->Dump([$responses], ['responses']));
+    
 
     my %post = (
         postername  => $post->{username},
@@ -1338,7 +1340,16 @@
             );
     }
     $self->log->debug(Data::Dumper->Dump([$posts], ['posts']));
-    
+ 
+    # fill in the responses
+    foreach my $p (@$posts) {
+        $p->{responses} = [];
+        foreach my $response (@$posts) {
+            if ($response->{parent} eq $p->{id}) {
+                push @{ $p->{responses} }, {id => $response->{id} };
+            }
+        }
+    }
 
     my @posts_html;
     foreach my $p (@$posts) {



More information about the Cpan-forum-commit mailing list