-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Gamification (badges) #3975
Gamification (badges) #3975
Conversation
private | ||
|
||
def status | ||
Decidim::Gamification.status_for(user, badge.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memoize this
|
||
delegate :current_user, to: :controller | ||
|
||
def show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this kind of show is not necessary
include Decidim::Core::Engine.routes.url_helpers | ||
include Decidim::IconHelper | ||
|
||
delegate :current_user, to: :controller, prefix: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix isn't necessary
# inconsistent. | ||
# | ||
# Returns nothing. | ||
def self.reset_badges(users = User.all) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we prevent this at production?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's actually most useful in production, in case there's any data loss or inconsistency.
validates :levels, empty: false | ||
|
||
validate do | ||
errors.add(:levels, "level thresholds should be ordered") if levels.sort != levels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I18n?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These messages aren't meant to reach user interfaces - it's an internal consistency validation. I don't think I18n make sense here.
@@ -24,6 +24,7 @@ def call | |||
|
|||
transaction do | |||
@proposal.update published_at: Time.current | |||
Decidim::Gamification.increment_score(@current_user, :proposals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe increment the score for all the authors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look into that.
ee24cd2
to
0d064ef
Compare
🎩 What? Why?
This feature adds user badges, which are earned when certain actions are performed.
📌 Related Issues
📋 Subtasks
CHANGELOG
entry📷 Screenshots (optional)
None