Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   seeders colors in browse (http://www.bvlist.com/showthread.php?t=12107)

elvira 24th May 2019 22:21

seeders colors in browse
 
hey,

how can I use seeders colors in browse like this one

http://shrani.si/f/15/6K/2Tl6w6jW/brez-naslova.png

Napon 25th May 2019 00:11

ive got this

darkalchemy 25th May 2019 08:32

I don't check whether the torrent is being seeded, but whether the torrent has been snatched. You can change this easily enough to peers if desired. In my opinion what the user wants to know is if they have snatched that particular torrent before, sometimes its difficult to remember.

I can't give you an exact change to your query, since you haven't posted it. But, what I do in my code is add a left join to the snatched column and then a select from that like this
Code:

LEFT JOIN snatched AS s on s.torrentid = t.id AND s.userid = $CURUSER['id']
and the select
Code:

IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go
Please escape the $CURUSER['id'] however your code does it.
Now you have the coloumn to_go available.
When you loop through the query to display the data, if to_go == -1 then the user has not snatched the torrent. If to_go = 100 then the have completed the torrent and if its anything else, then they have snatched it but not completed it. Then you simply adjust the color of the seeders to match what you want to show.

In my code, I have a column specifically for completed/snatched but I also use FluentPDO in that query and its a searchable column This is that portion of my query.
Code:

if (isset($_GET['unsnatched']) && $_GET['unsnatched'] == 1) {
    $count = $count->where('s.to_go IS NULL')
                  ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id']);
    $select = $select->select('IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go')
                    ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id'])
                    ->having('to_go = -1');
    $addparam .= 'unsnatched=1&';
} else {
    $select = $select->select('IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go')
                    ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id']);
}

I hope that can get something useful from this.

Napon 26th May 2019 11:25

what about get ratio colur will do this not the above pm me ill give you the code for it

darkalchemy 26th May 2019 15:25

Sure that would work, if you new what the ratio is. But, where do you get the ratio from? You just make it up or do you add a new query for each torrent, like I have seen a dozen times in code.

Please show your code, don't be afraid to show your awesomeness and show us want to be coders just how we are doing things the wrong way. I would gladly thank you profusely if you could just show me the error in my code.

Bump: My code actually shows whether the user has snatched the torrent.
https://i.imgur.com/oNR0hut.png
and it only uses 2 queries to get the data.
https://i.imgur.com/Lx7QoY5.png

Napon 26th May 2019 22:33

i do not thanks u do your way andd ill do it my way/with mysqli too

darkalchemy 26th May 2019 23:41

so....
you're saying you can't show me where my code is wrong?

What about showing us how you did it? So we can all learn from you.

If I said please, pretty please, would you show us? We have so much to learn.

Bump: Actually, don't worry about showing us your code, because we all know its not in your code. I've looked at your code. Napon's Code

Napon 27th May 2019 19:38

what did i tell you REMOVE THAT FROM YOUR GIT HUB...as that code as been updated with new code chap so your leaving old code on there thats no good to no one but did you listen NO NO NO NO

Just a side Note i do have this mod of seeders colors in browse too not hard to code your a coder so u should know how its not so hard is it...without the above you have done in codebox

darkalchemy 27th May 2019 23:40

hahahahahahahaha

you're an idiot

Napon 28th May 2019 18:50

1 Attachment(s)
could say the same as you...... you're an idiot big time


All times are GMT +2. The time now is 13:07.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.