rosedu / wouso

World of USO - the Official Repository
http://wouso.rosedu.org
Other
122 stars 103 forks source link

start-points formula ignored in default installation #470

Open razvand opened 10 years ago

razvand commented 10 years ago

When creating a new user through the Control Panel interface (the "Players" link), that player gets 0 points. The "start-points" formula in the "Formulas" link is by default configured to 420. However, it isn't taken into account when creating the new user.

razvand commented 10 years ago

Actually, points are configured when player first logs in; after logging in for the first time, the player gets 420 points (the configured value for "start-points" formula). Is this the expected behavior?

alexef commented 10 years ago

Yes, start-points are given when the user first login, since the majority of users are created at first login (because we're using ldap as the authentication provider).

If you justify the need, we can change the behaviour, and give start points on user creation.

razvand commented 10 years ago

I don't have a clear picture of what should be the expected behavior. But I incline to see the user having all required resources at creation time. Even in the case of LDAP, it's still creation time; it just happens that login time and creation time are identical.

alexef commented 10 years ago

It makes sense.

I see this implemented as a signal handler in the game core (the signal being emitted on Player.save, django already does that).

razvand commented 10 years ago

But, whenever a player is created, couldn't the implementation simply retrieve the formula and the value of the "start-points" variable and configure starting points for the player?

alexef commented 10 years ago

Yes. I was just emphasising the need to keep the code decoupled: user creation happens in core.models (and also django.contrib.auth.models), start-points giving should happen in core.game or core.game.god.

The recommended solution is to use signals.

razvand commented 10 years ago

Right, that makes sense.