opencaching / okapi

A common API for all National Opencaching.XX sites
22 stars 20 forks source link

Found and Attended logs must update OCPL Merit Badges #552

Closed following5 closed 5 years ago

following5 commented 6 years ago

In March 2017, the optional "Merit Bages" feature was added to OCPL code; see MeritBadgeController.php. It is enabled e.g. at Opencaching.PL.

services/logs/submit must update the user's badges for new "Found it" and "Attended" logs. Same with editing log types and deleting logs; see #421.

Funny that noone noticed the data lack for 18 months. Maybe because OCPL native code recalculates the bage data after every change, so it is fixed with the next on-site Found/Attended log.

mzylowski commented 6 years ago

Funny that noone noticed the data lack for 18 months @tripper1971 Noticed, but ignored this :)

kojoty commented 6 years ago

@following5 are you sure that there was a "data lack" - I believe (not sure) that everything is counted well, only user don't get notification about the new badges on time.

When user submit log next time (but directly by website - not by OKAPI) the notification appears.

We had known about this issue but - yes - ignored it because it needed changes at OKAPI side and in fact was a minor (corner case) thing.

following5 commented 6 years ago

I am sure that the badge_user table is not updated by OKAPI. Will be correctly updated when the user submits, edits or deletes another "Found it" or "Attended" log on the website.

So if a user only logs by an Okapi App, I think there will be no merits at all ...?

kojoty commented 6 years ago

So if a user only logs by an Okapi App, I think there will be no merits at all ...?

If "only" by OKAPI app - I agree - you're right. But after the first log by websites all badges will be applied. Creating a log is only a trigger for recalculating the stats.

But generally - I agree - we should prepare some solution for it.

mzylowski commented 6 years ago

When user submit log next time (but directly by website - not by OKAPI) the notification appears.

So if a user only logs by an Okapi App, I think there will be no merits at all ...?

Almost all my logs are added with OKAPI. When I added one log via the website a few weeks ago https://github.com/opencaching/opencaching-pl/issues/1616 happened So both issues are related.

following5 commented 6 years ago

b9a86651 adds a signalling mechanism, which hands merit badge update requests over to OCPL code. There they can be processed via cronjob.