• R/O
  • SSH
  • HTTPS

bullet: 提交


Commit MetaInfo

修訂56 (tree)
時間2013-06-17 22:58:18
作者tsugehara

Log Message

お気に入り機能でduplicate entryが出るバグがあったのを修正

Change Summary

差異

--- trunk/lib/Post.class.php (revision 55)
+++ trunk/lib/Post.class.php (revision 56)
@@ -853,14 +853,13 @@
853853 $sql .= ' and id > '.$old_id;
854854 }
855855 $sql .= ' group by t_theme';
856+ if ($order)
857+ $sql .= ' order by rcnt desc';
856858 if ($limit) {
857- if ($order)
858- $sql .= ' order by rcnt desc';
859859 $sql .= ' limit ?';
860860 return $this->db->getAll($sql, $limit);
861861 }
862- if ($order)
863- $sql .= ' order by rcnt desc';
862+
864863 return $this->db->getAll($sql);
865864 }
866865
@@ -1208,7 +1207,7 @@
12081207 }
12091208 $sql = 'insert into '.$this->db->getTableName($this->getFavoriteTable($id));
12101209 $sql .= ' (favorite_id, id, user_id, anonymous, display_name, trip, content, json_theme, t_id, t_theme, t_user_id, created)';
1211- $sql .= '('.implode(') union (', $unions).') order by id';
1210+ $sql .= ' select '.$field.' from (('.implode(') union (', $unions).') order by id) p group by id';
12121211 $ret = $this->db->execute($sql, $params, TRUE);
12131212 if (empty($ret)) //false or 0
12141213 return FALSE;
Show on old repository browser