|
#1
|
||||
|
||||
seeders colors in browse
|
#2
|
|||
|
|||
ive got this
|
#3
|
|||
|
|||
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'] Code:
IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go 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']); } |
The Following User Says Thank You to darkalchemy For This Useful Post: | ||
papad (26th May 2019)
|
#4
|
|||
|
|||
what about get ratio colur will do this not the above pm me ill give you the code for it
|
#5
|
|||
|
|||
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. and it only uses 2 queries to get the data. |
The Following User Says Thank You to darkalchemy For This Useful Post: | ||
Fynnon (26th May 2019)
|
#6
|
|||
|
|||
i do not thanks u do your way andd ill do it my way/with mysqli too
|
#7
|
|||
|
|||
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 Last edited by darkalchemy; 26th May 2019 at 23:53. |
#8
|
|||
|
|||
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 |
#9
|
|||
|
|||
hahahahahahahaha
you're an idiot |
#10
|
|||
|
|||
could say the same as you...... you're an idiot big time
|
|
|