-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update level_id in experiences table when levelled up #48
Conversation
@7OMI I don't understand what this fixes? Can you add a description to the PR that explains why this fix is needed? Provide examples of when the code fails. |
The Q. Why is the user level stored in two places anyway?
|
What code are you running to get this data? It looks like Please let me know the steps you've taken so I can try to replicate. Also list if you have any of the config settings different to the defaults. Thanks. |
If it is written out immediately after the point is given, it works: $user = \App\Models\User::whereId(3)->first(); // or: auth()->user()
$user->addPoints(10);
$user->addPoints(100);
echo 'LEVEL: ' . $user->getLevel() . '<br>'; // Get: `LEVEL: 2`
echo 'NEXT LEVEL AT: ' . $user->nextLevelAt() . '<br>'; // Get: `NEXT LEVEL AT: 130` If you don't add a point, but simply want to write out, it won't work: $user = \App\Models\User::whereId(3)->first(); // or: auth()->user()
echo 'LEVEL: ' . $user->getLevel() . '<br>'; // Get: `LEVEL: 1`
echo 'NEXT LEVEL AT: ' . $user->nextLevelAt() . '<br>'; // Get: `NEXT LEVEL AT: 0`
Only one change has been made. This has been added to the AUDIT_POINTS=true Additional information:
|
tests: Added a new sanity test
@7OMI Thanks man for pointing this out! I've changed the way it is fixed though to better suit the rest of the code. I also added another sanity test. |
No description provided.