• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Cannot reproduce Trophies not awarded

Affected version
2.0.0 Beta 8

katsulynx

Well-known member
#1
I've created a bunch of trophies on my website and ran the "Update user trophies" cron job manually. Some of the trophies were granted to the users as expected, but some weren't. I originally thought it would be due to one of my add-ons, so I went to my test installation and experimented around, but after not being able to identify any issue, I went ahead and just disabled all add-ons. The trophy however still isn't awarded.

The trophy on my online installation had a "High DPI Avatar" user criteria as only requirement.
The trophy on my local installation has "4 forum posts" as requirement, the test account in question has a total of 77 posts.

Just as I am writing, the online account was awarded the High DPI Avatar trophy, not sure what happened. The one on the local installation, the trophy still isn't awarded...

The ACP doesn't log errors, nor does running the cron job manually throw any.
 

Mike

XenForo developer
Staff member
#2
The cron only runs on recently active users. You want to run the cache rebuild to have it trigger for all users.
 

katsulynx

Well-known member
#3
Well, the user in question is also my administrator account, through which I run the cron job and check back to the forum to see whether it was granted. So he was definitely active.
 

Chris D

XenForo developer
Staff member
#4
On my test board I have 450 messages. I just created a trophy to award if a user has over 400 messages. I ran the Cron and it ran fine and awarded the trophy, hence I can't personally reproduce this.

Unfortunately it might require you to check some of the more obvious explanations. Is the criteria set up correctly? Are you sure there's no conflicting criteria, e.g. restricting it to certain groups or other conditions you hadn't intended to enable? Are you certain it hasn't already been awarded? If you delete the trophy and re-create it does that help at all?
 

katsulynx

Well-known member
#5
Are you sure there's no conflicting criteria, e.g. restricting it to certain groups or other conditions you hadn't intended to enable?
Double-checked it. The only criteria set is "Posted at least 4 messages". (https://my.mixtape.moe/jxbraz.mp4)

Are you certain it hasn't already been awarded? If you delete the trophy and re-create it does that help at all?
100% certain. These are all trophies that are currently in the database: (Trophy ID is 13)


If you delete the trophy and re-create it does that help at all?
Just recreated it without deleting the old one and re-ran the cron job. Now I got awarded both, while running with only the old one right before doing so got me awarded nothing...
 

Chris D

XenForo developer
Staff member
#6
How were you ascertaining if the award was happening, were you checking in the database only or looking on the front end to see if you had been given an alert?
 

Chris D

XenForo developer
Staff member
#8
We currently have no theory as to how this could happen, and in some ways it appears to have sorted itself out. If you could do some more testing with it, that would be appreciated, but this is really still something that we cannot reproduce and not something we can see an obvious cause for in the code.

The only theory I had was sort of proven wrong and that was one of how the user's activity is logged.

Theoretically, if you go straight to admin.php and log in, you're not considered active. You're only considered active if you have an entry in the xf_session_activity table. Even then, we don't actually use the date in that table when working out if a user is currently active for the purposes of this trophy cron. The user's last_activity value is updated from the xf_session_activity table roughly once per hour.

However, the trophy cron also considers activity within the last two hours to be recently active. In that case, the last_activity field should have been updated, at the latest, one hour ago. Unless of course there's some other issue which meant your cron jobs weren't running on time.

Until we get some more reports of this or a more reliable reproduction case we're not likely to be able to progress this much further.