beyond-all-reason / teiserver

Middleware server for online gaming
https://www.beyondallreason.info/
MIT License
50 stars 47 forks source link

Make it easier to add fake users with specific playtime for testing purposes #251

Open jauggy opened 4 months ago

jauggy commented 4 months ago

Make it easier to add fake users with specific playtime or adjust existing users to have specific player time. Player time is used to calculate rank on login. This feature would be useful for testing.

jauggy commented 4 months ago

To bypass email checks we can change this setting (Require Email Verification): Screenshot 2024-04-14 210752

I still want a way to set play time though to test various chev levels.

L-e-x-o-n commented 4 months ago
  1. Run server in interactive mode with iex -S mix phx.server
  2. Go to http://localhost:4000/teiserver/admin/site#Profiles and set Rank method to role
  3. Find out the user ID of the user you want to test (http://localhost:4000/profile/ for example)
  4. Execute command in iex: Teiserver.Account.update_user_stat(<ID>, %{"player_minutes"=> 100*60, "spectator_minutes"=>20*60, "total_minutes"=>130*60}) (you can only set spectator_minutes and player_minutes, only those are used for rank calculation)
  5. Login as the user in game (playtime will be updated after the previous step, but rank is only recalculated on login)
  6. Confirm that your rank changed (for example by visiting http://localhost:4000/profile//playtime)
jauggy commented 4 months ago

So should we put a guide for this and link it somewhere?

Either a new doc or add to testing guide.

L-e-x-o-n commented 4 months ago

Not necessarily, I am just showing an example of how it can be done if you need it right now for some tests. The issue is still valid and an easier way to do it would be nice.