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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamification (badges) #3975

Merged
merged 1 commit into from Aug 27, 2018
Merged

Gamification (badges) #3975

merged 1 commit into from Aug 27, 2018

Conversation

@josepjaume
Copy link
Contributor

@josepjaume josepjaume commented Aug 7, 2018

馃帺 What? Why?

This feature adds user badges, which are earned when certain actions are performed.

馃搶 Related Issues

馃搵 Subtasks

  • Add CHANGELOG entry
  • Add documentation regarding the feature
  • Add/modify seeds
  • Add tests

馃摲 Screenshots (optional)

None

@ghost ghost assigned josepjaume Aug 7, 2018
private

def status
Decidim::Gamification.status_for(user, badge.name)

This comment has been minimized.

@oriolgual

oriolgual Aug 7, 2018
Member

Memoize this


delegate :current_user, to: :controller

def show

This comment has been minimized.

@oriolgual

oriolgual Aug 7, 2018
Member

I think this kind of show is not necessary

@josepjaume josepjaume removed the status: WIP label Aug 10, 2018
@ghost ghost added the status: WIP label Aug 10, 2018
@josepjaume josepjaume added in-review and removed status: WIP labels Aug 10, 2018
include Decidim::Core::Engine.routes.url_helpers
include Decidim::IconHelper

delegate :current_user, to: :controller, prefix: false

This comment has been minimized.

@oriolgual

oriolgual Aug 10, 2018
Member

prefix isn't necessary

# inconsistent.
#
# Returns nothing.
def self.reset_badges(users = User.all)

This comment has been minimized.

@oriolgual

oriolgual Aug 10, 2018
Member

Should we prevent this at production?

This comment has been minimized.

@josepjaume

josepjaume Aug 20, 2018
Author Contributor

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

This comment has been minimized.

This comment has been minimized.

@josepjaume

josepjaume Aug 20, 2018
Author Contributor

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)

This comment has been minimized.

@oriolgual

oriolgual Aug 10, 2018
Member

Maybe increment the score for all the authors?

This comment has been minimized.

@josepjaume

josepjaume Aug 20, 2018
Author Contributor

Will look into that.

@ghost ghost added the status: WIP label Aug 20, 2018
@josepjaume josepjaume removed the status: WIP label Aug 20, 2018
@ghost ghost added the status: WIP label Aug 20, 2018
@josepjaume josepjaume removed the status: WIP label Aug 20, 2018
@ghost ghost added the status: WIP label Aug 20, 2018
@josepjaume josepjaume removed the status: WIP label Aug 20, 2018
@ghost ghost added the status: WIP label Aug 20, 2018
@josepjaume josepjaume removed the status: WIP label Aug 21, 2018
@josepjaume josepjaume force-pushed the feature/badges branch from ee24cd2 to 0d064ef Aug 21, 2018
@ghost ghost added the status: WIP label Aug 21, 2018
@josepjaume josepjaume removed the status: WIP label Aug 21, 2018
@josepjaume josepjaume merged commit 656d843 into master Aug 27, 2018
28 checks passed
28 checks passed
WIP ready for review
Details
ci/circleci: accountability Your tests passed on CircleCI!
Details
ci/circleci: admin Your tests passed on CircleCI!
Details
ci/circleci: api Your tests passed on CircleCI!
Details
ci/circleci: assemblies Your tests passed on CircleCI!
Details
ci/circleci: blogs Your tests passed on CircleCI!
Details
ci/circleci: budgets Your tests passed on CircleCI!
Details
ci/circleci: build_design_app Your tests passed on CircleCI!
Details
ci/circleci: build_test_app Your tests passed on CircleCI!
Details
ci/circleci: comments Your tests passed on CircleCI!
Details
ci/circleci: consultations Your tests passed on CircleCI!
Details
ci/circleci: core Your tests passed on CircleCI!
Details
ci/circleci: debates Your tests passed on CircleCI!
Details
ci/circleci: generators Your tests passed on CircleCI!
Details
ci/circleci: initiatives Your tests passed on CircleCI!
Details
ci/circleci: main Your tests passed on CircleCI!
Details
ci/circleci: meetings Your tests passed on CircleCI!
Details
ci/circleci: pages Your tests passed on CircleCI!
Details
ci/circleci: participatory_processes Your tests passed on CircleCI!
Details
ci/circleci: proposals Your tests passed on CircleCI!
Details
ci/circleci: sortitions Your tests passed on CircleCI!
Details
ci/circleci: surveys Your tests passed on CircleCI!
Details
ci/circleci: system Your tests passed on CircleCI!
Details
ci/circleci: upload-coverage Your tests passed on CircleCI!
Details
ci/circleci: verifications Your tests passed on CircleCI!
Details
codeclimate All good!
Details
codeclimate/diff-coverage 98% (80% threshold)
Details
codeclimate/total-coverage 98% (0.0% change)
Details
@josepjaume josepjaume deleted the feature/badges branch Aug 27, 2018
@josepjaume josepjaume added this to the CDP3 milestone Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can鈥檛 perform that action at this time.