sveneisenschmidt / yay

Gamification made simple. Integrate gamification into your organisation incl. achievements, goals, levels and leaderboards.
Apache License 2.0
72 stars 7 forks source link

Unable to grant achievements #233

Open limecakeio opened 5 years ago

limecakeio commented 5 years ago

Hi There!

I am currently utilising the Yay-Framework for a university project as a gamification layer for a student learning platform. Up to this stage, things have been progressing well. Using the stable docker image, I am able to integrate custom actions as well as add an existing user-base to the service.

I am now running into an issue whereby users are not being granted achievements when they complete actions. I took a step back, and decided to see if this would even work using the demo integration provided, and it seems that while using a local build of yay it does work, however, it does not work using the supplied docker image.

Comparing the symphony debug logs between the local setup and the dockerized one when posting 5 * actions for a user (thus expecting to be rewarded the first demo achievement), I noticed that the local build would carry out a few additional steps in comparison to the docker one.

My setup to use the demo-integration is as follows:

Dockerfile

FROM sveneisenschmidt/yay:stable COPY ./origami-docker-run.sh docker-run.sh

origami-docker-run.sh

`

!/bin/bash

php bin/console doctrine:database:create --if-not-exists --env=${APP_ENV}; php bin/console doctrine:schema:update --em=default --force --env=${APP_ENV}; php bin/console yay:integration:enable default integration/default --env=${APP_ENV}; php bin/console yay:integration:enable demo integration/demo --env=${APP_ENV}; php bin/console yay:recalculate php bin/console cache:clear --no-warmup php bin/console cache:warmup --env=${APP_ENV};

apache2-foreground `

docker-compose.yml

` version: "3.5" services: origami-yay: build: yay/. #Path to Dockerfile container_name: origami-yay environment:

networks: origami: `

Create a new User

POST to: http://localhost:50800/api/players/ { "name": "Test User", "username": "1500001", "email": "tu@abc.de", "image_url": "https://avatars.dicebear.com/v2/male/rod%20gonzales.svg" }

Grant an action 5 times to user

POST: http://localhost:50800/api/progress/ { "username": "1500001", "actions": ["demo-action-02", "demo-action-02", "demo-action-02", "demo-action-02", "demo-action-02"] } This returns a HTTP-Status 200 with an empty collection -> [] expected would be for an achievement within this collection.

As a side note, I am not including the blackfire profiler or the cli in my environment.

I really hope that I am just missing a trick here and looking forward to your response!

Cheers,

Richard

sveneisenschmidt commented 5 years ago

Hi Richard, thanks for reaching out to me.

I noticed that the local build would carry out a few additional steps in comparison to the docker one.

Do you know which additional steps are run?

Have a nice evening Sven

limecakeio commented 5 years ago

Hi Sven,

Thanks for your super quick response! The steps I am referring to can be seen in the Symfony logs.

To highlight the difference, and to keep the logs short, I have first granted the user 4 * demo-action-02, not expecting any achievements, which is correct. Upon granting the action one more time, I would expect an achievement to be granted. This works with the local (still dockerized) version of yay which is launched with make enable-demo followed by make start. The following screengrab shows the full debug protocol and I have also highlighted the differences:

yay-local

Using the stable docker image, the same procedure does not yield the expected result. Upon granting the 5th action, the user is not automatically rewarded with an achievement (as a side effect, no second e-mail is sent) as shown in the following debug protocol:

yay-docker

As you can see, no errors or warning are thrown nor shown. The steps highlighted in the local-yay screen, which look like they handle granting the achievement, are simply not executed, but I have no way to see as to why.

Hope this helps in sheding a little light on things, let me know if I can supply you with anything else!

Cheers,

Richard

sveneisenschmidt commented 5 years ago

I see. Thanks for the detailed report. Please give me a day to look into it. I will build a custom image as well and enable the demo. Let’s see if it fails too.

Are you using the sveneisenschmidt/yay-demo:latest image for your test to reproduce the problem or sveneisenschmidt/yay:latest?

Have a nice day Sven

limecakeio commented 5 years ago

Hi Sven,

Sorry about the late reply! I am using the sveneisenschmidt/yay:latest image, which also makes it possible to enable the demo within, hence I figured if that demo works, so should my configuration.

Have a good one!

Cheers, Richard

limecakeio commented 5 years ago

Hi There Sven,

Just wanted to touch base, to see if there are any updates on this issue at the moment?

Cheers,

Richard