Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badge Level System #16

Open
Lastwisher opened this issue Oct 3, 2019 · 3 comments
Open

Badge Level System #16

Lastwisher opened this issue Oct 3, 2019 · 3 comments

Comments

@Lastwisher
Copy link

Hello,

Thanks for amazing plugin such a time saver.

I have a quick question.

I want to add a badge with
level 1
level 2
level 3

All of them have different descriptions.

for exc :
Level 1 : Has 100 post
Level 2 : Has 200 post
Level 3 : Has 300 post

My issues :
How to archive this with this plugin.
If i add description there is only one option.
I can make something like

if ($this->level == 1) $this->description = 'xx';

But as i see plugin does not read this value every time.

Thanks

@Lastwisher
Copy link
Author

And a quick bug report :

$badges[] = app($badgeRootNamespace . '\\' . pathinfo($file, PATHINFO_FILENAME));

This line cousing double construct on badges becouse of singleton construct again at :

@saqueib
Copy link
Member

saqueib commented Oct 9, 2019

@Lastwisher I am trying to understand your scenario here. correct me if I am wrong.

level 1
level 2
level 3

All of them have different descriptions.

for exc :
Level 1 : Has 100 post
Level 2 : Has 200 post
Level 3 : Has 300 post

You can define all types of level inside config file /config/gamify.php

// All the levels for badge
    'badge_levels' => [
        'beginner' => 1,
        'intermediate' => 2,
        'advanced' => 3,
    ],

now the next thing will be to just create separate badges for each level.

And thanks for the bug report, I will fix it in next release

@Lastwisher
Copy link
Author

No problem i were thinking to follow same way as you said, but creating new badges for each level kind of not so pretty.

Also logic of earning badge were problematic for me, im doing most of checks at database level and foreach check at badges will bring some queries to server.

So i made a change at there now badge earning condition is checked when badge awarded.

You can check my pr at here : #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants