Browse Source

Update calcStat for Topic

Add data update for the first post
Visman 5 years ago
parent
commit
da1959e449
1 changed files with 13 additions and 0 deletions
  1. 13 0
      app/Models/Topic/CalcStat.php

+ 13 - 0
app/Models/Topic/CalcStat.php

@@ -33,6 +33,19 @@ class CalcStat extends Method
 
             $num_replies = $this->c->DB->query($sql, $vars)->fetchColumn();
 
+            $sql = 'SELECT p.id, p.poster, p.poster_id, p.posted
+                    FROM ::posts AS p
+                    WHERE p.topic_id=?i:tid
+                    ORDER BY p.id
+                    LIMIT 1';
+
+            $result = $this->c->DB->query($sql, $vars)->fetch();
+
+            $this->model->poster        = $result['poster'];
+            $this->model->poster_id     = $result['poster_id'];
+            $this->model->posted        = $result['posted'];
+            $this->model->first_post_id = $result['id'];
+
             $sql = 'SELECT p.id, p.poster, p.poster_id, p.posted, p.edited
                     FROM ::posts AS p
                     WHERE p.topic_id=?i:tid