Skip to content

Unable to grant achievements #233

@limecakeio

Description

@limecakeio

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:
- APP_ENV=dev
- ALLOWED_ORIGINS=["http://origami:50080", "http://localhost:50080"]
- DATABASE_HOST=origami-db
- DATABASE_NAME=yay
- DATABASE_PORT=3306
- DATABASE_USER=root
- DATABASE_PASSWORD=abc123
- REDIS_HOST=redis
- REDIS_PORT=6379
- MAILER_URL=smtp://yay-mail:1025
ports:
- 50800:80
depends_on:
- redis
- origami-db
- yay-mail
networks:
- origami

origami-db:
container_name: origami-db
build: origami-service/db/
command: mysqld --sql_mode=""
ports:
- ${MYSQL_PORT}:3306
environment:
- MYSQL_ROOT_PASSWORD=abc123
networks:
- origami

redis:
image: redis
container_name: origami-redis
networks:
- origami

yay-mail:
image: schickling/mailcatcher
ports:
- "50081:1080"
networks:
- origami

networks:
origami:
`

Create a new User

POST to: http://localhost:50800/api/players/
{ "name": "Test User", "username": "1500001", "email": "[email protected]", "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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions