# |
Jul 18th 2018, 12:27 |
tim |
set rank = rank + 1 where rank between oldPlayerRank and newPlayerRank - 1, and then you set newPlayerRank to oldPlayerRank |
# |
Jul 18th 2018, 12:26 |
flavius |
40 beats 38, 40 becomes 38, 38 becomes 39, 39 becomes 40 |
# |
Jul 18th 2018, 12:26 |
flavius |
regardless if the player is going up one or two at most you still need to update all of the other ranks to make him fit |
# |
Jul 18th 2018, 12:24 |
flavius |
lol good luck with that :slightly_smiling_face: |
# |
Jul 18th 2018, 12:24 |
flavius |
yeah but a good programmer has every thing covered |
# |
Jul 18th 2018, 12:24 |
turkles |
normally its a player going up one or two at most |
# |
Jul 18th 2018, 12:24 |
turkles |
yes, but likelyhood of a big change like that is low... very low |
# |
Jul 18th 2018, 12:24 |
flavius |
madness :P |
# |
Jul 18th 2018, 12:23 |
flavius |
because if 1 becomes 2, 2 becomes 3 and so on |
# |
Jul 18th 2018, 12:23 |
turkles |
no, I have to update *if* a low rank beats a high rank, and only those that are in the rank between the two |
# |
Jul 18th 2018, 12:23 |
flavius |
so for every game played you will need to update **ALL** of the player ranks? that's so inefficient |
# |
Jul 18th 2018, 12:23 |
turkles |
I don't make the rules, I just have to code something to work out who is what rnk |
# |
Jul 18th 2018, 12:22 |
turkles |
it isn't tennis, and dem is the rules of the system :P |
# |
Jul 18th 2018, 12:22 |
turkles |
yes |
# |
Jul 18th 2018, 12:22 |
flavius |
if 1 looses to 90, 90 becomes 1 and 1 becomes, what, 2? |
# |
Jul 18th 2018, 12:21 |
flavius |
90 beats 1 and now he's 1? what madness is this? :slightly_smiling_face: |
# |
Jul 18th 2018, 12:20 |
turkles |
not quite, if my player rank 90 plays one game and beats player rank 1, they are rank 1. In a points system they only have whatever the points value of the match is? |
# |
Jul 18th 2018, 12:19 |
flavius |
you can do that with a point system as well :P |
# |
Jul 18th 2018, 12:19 |
turkles |
player who they beat is now rank 4, player who was rank 4 is now rank 5 |
# |
Jul 18th 2018, 12:19 |
turkles |
if player rank 5 beats player rank 3, they take rank 3 |
# |
Jul 18th 2018, 12:19 |
flavius |
then how do you calculate the rank? |
# |
Jul 18th 2018, 12:18 |
turkles |
but there are no points.. |
# |
Jul 18th 2018, 12:17 |
flavius |
File uploaded https://cakesf.slack.com/files/U75U0UMR9/FBSKFMC8J/image.png / https://slack-files.com/T053DPNCM-FBSKFMC8J-186151c8a1 |
# |
Jul 18th 2018, 12:16 |
flavius |
it makes no sense to save the rank, you should save the points for each player |
# |
Jul 18th 2018, 12:15 |
turkles |
@flavius There are events which a random number of people can enter, which rank players, and I only have to change those where someone has ended up above someone with a higher rank. It's a bit arbitrary like a tennis ladder. |
# |
Jul 18th 2018, 12:13 |
info356 |
I need some help with events.. https://stackoverflow.com/questions/48372487/cakephp-3-dynamic-database-connection Where should i put: \Cake\Event\EventManager::instance()->on( 'Connection.aliased', |
# |
Jul 18th 2018, 12:08 |
flavius |
why not save the points and do the rank on the fly? |
# |
Jul 18th 2018, 12:07 |
turkles |
Hi all, I have an array [1 => [name=mark, rank=100],2 => [name=dave, rank=99]...] and during re-ranking I want to reduce all members with a current rank between x and y, what is the best way of doing this? |
# |
Jul 18th 2018, 11:30 |
abdualelah.mdy |
@neon1024 thanks for your help |
# |
Jul 18th 2018, 11:30 |
neon1024 |
Well, just the controllers in most cases, if you’re using conventions |
# |
Jul 18th 2018, 11:30 |
neon1024 |
Yep |
# |
Jul 18th 2018, 11:29 |
abdualelah.mdy |
@neon then i have to connect all pages by myself right ? |
# |
Jul 18th 2018, 11:27 |
neon1024 |
I would recommend removing the fallback routes, to prevent duplicate content for seo purposes |
# |
Jul 18th 2018, 11:27 |
neon1024 |
https://github.com/cakephp/app/blob/master/config/routes.php#L62-L78 |
# |
Jul 18th 2018, 11:25 |
neon1024 |
@abdualelah.mdy You can’t really. The default routes are generated by the Fallback Routing, called at the end of your routes file |
# |
Jul 18th 2018, 11:24 |
abdualelah.mdy |
How can I block default route that is generated by CakePHP ( note : i don't want to block all of them ) |
# |
Jul 18th 2018, 11:24 |
neon1024 |
In my experience, the snippet in the book works for almost every use-case |
# |
Jul 18th 2018, 11:23 |
slackebot |
immediately to save some processing. |
# |
Jul 18th 2018, 11:23 |
neon1024 |
Well @okelet do bear in mind that Authentication and Authorisation are different. Here you’re talking about Authorisation, which as you say, will be checked on each Controller action, if you’ve set Auth to Controller. Which will then call your `isAuthorized()` method. If the session expires, a null will be passed. I copied the book and only check for what I need. I guess you could “go home early” and if the user is null return false |
# |
Jul 18th 2018, 11:22 |
okelet |
thanks @neon1024 i was supposing that when I enable auth, i always force the user to be validated except for allowed actions... my error. |
# |
Jul 18th 2018, 11:20 |
mr.mjsm |
what i am facing now is that. the foreign key in the emails table is the automatic increment field in companies. so there is going to be some difficulties ;( |