Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c478920d

Přidáno uživatelem Ondřej Fibich před asi 9 roky(ů)

Undo my stupid mistake (I have pushed issue-957 to master instead of develop). Do I have copied files from GitHub master and push them back..

Zobrazit rozdíly:

application/models/members_whitelist.php
* @property date $until
* @property bool $permanent
* @property string $comment
* @property integer $user_id
* @property User_model $user
*/
class Members_whitelist_Model extends ORM
{
protected $belongs_to = array('member','user');
protected $belongs_to = array('member');
/**
* Gets members whose are whitelisted.
......
m.id, IFNULL(f.translated_term, e.value) AS type,
m.name, m.name AS member_name, a.balance,
a.id AS aid, a.comments_thread_id AS a_comments_thread_id,
IF(mw.permanent > 0, 1, 2) AS whitelisted, a_comment,
CONCAT(u.name,' ',u.surname) AS user_name, u.id AS user_id
IF(mw.permanent > 0, 1, 2) AS whitelisted, a_comment
FROM members m
JOIN members_whitelists mw ON mw.member_id = m.id
LEFT JOIN accounts a ON a.member_id = m.id AND m.id <> 1
......
LEFT JOIN comments_threads ct ON a.comments_thread_id = ct.id
LEFT JOIN enum_types e ON m.type = e.id
LEFT JOIN translations f ON e.value = f.original_term AND lang = ?
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.since <= CURDATE() AND mw.until >= CURDATE()
) m
$where
......
SELECT
m.id, IFNULL(f.translated_term, e.value) AS type,
m.name AS member_name, a.balance,
IF(mw.permanent > 0, 1, 2) AS whitelisted,
CONCAT(u.name,' ',u.surname) AS user_name
IF(mw.permanent > 0, 1, 2) AS whitelisted
FROM members m
JOIN members_whitelists mw ON mw.member_id = m.id
LEFT JOIN accounts a ON a.member_id = m.id AND m.id <> 1
LEFT JOIN comments_threads ct ON a.comments_thread_id = ct.id
LEFT JOIN enum_types e ON m.type = e.id
LEFT JOIN translations f ON e.value = f.original_term AND lang = ?
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.since <= CURDATE() AND mw.until >= CURDATE()
) m
$where
......
public function get_member_whitelists($member_id)
{
return $this->db->query("
SELECT
mw.*, IF(mw.since <= CURDATE() AND mw.until >= CURDATE(), 1, 0) AS active,
CONCAT(u.name,' ',u.surname) AS user_name, u.id AS user_id
SELECT mw.*, IF(mw.since <= CURDATE() AND mw.until >= CURDATE(), 1, 0) AS active
FROM members_whitelists mw
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.member_id = ?
ORDER BY permanent DESC, until DESC, since DESC
", $member_id);

Také k dispozici: Unified diff