Skip to content
This repository was archived by the owner on Dec 17, 2019. It is now read-only.

Added prerequisites number field, to allow auto-awarding based on a subset of the prerequisites#171

Open
askvictor wants to merge 3 commits intomozilla:masterfrom
askvictor:master
Open

Added prerequisites number field, to allow auto-awarding based on a subset of the prerequisites#171
askvictor wants to merge 3 commits intomozilla:masterfrom
askvictor:master

Conversation

@askvictor
Copy link
Contributor

No description provided.

…-awarding of a badge when a set number of prerequisites met e.g. Badge Foo is awarded when 3 out of the 5 prerequisites have been obtained.
…awarding badge' for the current badge. If a user holds the allows_award_badge for a particular badge Foo, they will be allowed to award badge Foo to others.
@willkg
Copy link
Member

willkg commented Aug 24, 2013

This work seems to be done in pull #172, too. Are you looking to land both pull requests?

@askvictor
Copy link
Contributor Author

Crap; I seem to have stuffed up my PR. The two were different features. The use case for this one is along these lines:

  • Python Programmer badge
  • Ruby Programmer badge
  • JS programmer badge
  • C programmer badge
  • Multi-lingual badge: this is auto awarded when the user has received any two of the above 4 badges.

@willkg
Copy link
Member

willkg commented Aug 25, 2013

That makes a lot of sense to me.

@lmorchard I haven't reached a good enough understanding of the django-badger architecture to know whether this makes sense or whether there's a better way to implement the use case. Can you take a look at this?

@lmorchard
Copy link
Contributor

TL;DR: This looks good, but we might not want to merge it because I'd like to simplify the core badge model.

The issue is I could see a prereq feature growing for a lot of cases - eg. all prereqs, 3 of 5 prereqs, 1 required badge and 1 more from a set of choices, complex trees of preteqs, etc.

So, it occurs to me that this would work better in a per-app badges.py as a signal handler, keeping the core model simpler. That is, remove the current prerequisite checking from the core model altogether. Then, subscribe to badge_was_awarded in an app's badges.py and do the prereq work there.

It might also be interesting if we had a place to grow "helpers" for badges.py that offer common but optional nuggets of badge logic like this.

@askvictor
Copy link
Contributor Author

Perhaps provide two different levels of badges - a simple, stripped down version, and a more fully featured, customisable one? This might allow developers to do less coding in setting up a more complex badging system. Just a though - I guess I'd like to see how the signal/badges.py system would work.

As for more complex prerequisites (e.g. badge Q is prereqs: 1 required badge (badge A) + 1 out of a set of 3 ( badges X,Y,Z) )- this could be implemented without any extra code changes, by creating a tree of badges involving 'meta' badges (meta is probably the wrong term, but I'm basing it off dpkg meta packages), which are awarded but not displayed. So in the above example there'd be a meta badge W which has prereq 1 out of (X,Y,Z). Badge Q has pre-reqs both A and W. Not sure from an end-user perspective if this would be more or less confusing that alternatives.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants