Karma
Karma plugin for openSUSE Connect
Developer: Priyanka Menghani
About
We want contributing to the openSUSE community more fun! The Karma plugin implements the Karma concept on openSUSE Connect. The basic motivation is similar to the ‘Reputation’ score on StackExchange. On Connect, the users gain Karma by completing bug-fixes, Wiki entries, posts to the openSUSE planet, promoting openSUSE events on Twitter, making Build Service commits, etc. People can also send across Kudos to others who have been supportive. Badges are awarded based on the Karma score.
Features
Karma has the following features-
Count your Bugs
- Karma takes a count of the bugs you fix on Novell's Bugzilla.
- Bugs are fetched through user's Novell email id.
- It takes into account the bugs that have been marked resolved and verified and then rewards them.
- The bugzilla implementation does not take into account the licensed bugs which are hidden from public.
- Here is how they are marked:
Bug Type | Score |
---|---|
Blocker | 10 |
Critical | 8 |
Major | 7 |
Normal | 5 |
Minor | 3 |
Enhancement | 2 |
Count your OBS commits
- Karma fetches the 10 latest updated packages every 5 minutes and looks for the changes file for each.
- Within that changes file it reads the user's email who made the commit, locates that user on Connect and reward him.
- Each such commit earns you 5 points.
- Make sure the email id you registered on Connect is the same one that OBS uses. It doesn't matter if you have or you haven't specified your repositories on Connect, you still get rewarded.
Count your Planet openSUSE posts
- Karma fetches planet openSUSE's RSS feed and looks for your blog url. If found, you get rewarded with 5 points.
- Globally all posts are rewarded for. But you do need to specify your blog url on Connect if you want to be rewarded.
- Lizard bloggers are unfortunately not rewarded.
Count your Tweets
- Karma uses your twitter handle specified on Connect, fetches your latest 5 tweets, looks for openSUSE hashtag and rewards them.
- Be sure to specify your handle on Connect.
- Each such tweet fetches you 2 karma points.
- Protected users are not rewarded since karma plugin can not find them.
Count your Wiki Edits
- Karma fetches your latest edits on openSUSE wiki and rewards them.
- It uses your username to fetch your 10 latest edits.
- Even your wiki entries with the localed wikis are rewarded for.
- Each such wiki edit fetches you 2 points.
Integral Part of the Karma Plugin
Cron Script
The karma plugin runs on a cron script. This script is designed to run every 5 minutes. It fetches five Connect users who have stayed the longest without karma update and then updates for them. This is carried on until karma has been updated for all the users.
register_plugin_hook('cron','fiveminute','karma_cron');
This statement registers cron hook to trigger function karma_cron every five minutes. karma_cron is defined to complete the following jobs every 5 minutes.
- Extract 5 users from Connect who have stayed longest without updating.
- Call the build service update method which finds the latest updated packages and rewards you if you were the one who just made a commit.
- For each of the 5 users extracted it runs the karma update method to update their karma score.
- Calculate user ranks based on total karma score on Connect.
What does the karma plugin show?
Karma widget
The karma widget available from the widget gallery shows user's karma details. The following are shown by the karma widget
Badge Assignment
Badge assignment is a part of the karma update method, user's developer, marketing and wiki score is sent across and comparing it with the maximum score in each respect, a badge is assigned. The current algorithm for badge assignment is
Case | Badge |
---|---|
1. Bugzilla score, Planet openSUSE score, Twitter score, Build Service score, Wiki score all are zero | Novice |
2. Developer score >= Marketing score and Developer score >= Wiki score | |
2.1) Developer score = Max Developer | Numero Uno |
2.2) Developer score >= 0.85 * Max Developer and Developer score <= Max Developer | Elite Stallion |
2.3) Developer score >= 0.75 * Max Developer and Developer score < 0.85 * Max Developer | SUSE Samurai |
2.4) Developer score >= 0.5 * Max Developer and Developer score < 0.75 * Max Developer | Citizen Patrol |
2.5) Developer score >= 0.40 * Max Developer and Developer score < 0.5 * Max Developer | |
2.5.a) Bugzilla score > Build Service score | Bug Buster |
2.5.b) Bugzilla score < Build Service score | Build Superhero |
2.6) Developer score < 0.40 * Max Developer and Developer score > 0 | Notable Endeavor |
3. Marketing score > Developer score and Marketing score > Wiki score | |
3.1) Marketing score = Max Marketing score | SUSE Herald |
3.2) Marketing score >= 0.75 * Max Marketing and Marketing score < Max Marketing | Autobiographer |
3.3) Marketing score >= 0.5 * Max Marketing and Marketing score < 0.75 * Max Marketing | Enthusiast |
3.4) Marketing score < 0.5 * Max Marketing | |
3.4.a) Planet openSUSE score > Twitter score | Blog-o-Manic |
3.4.b) Planet openSUSE score < Twitter score | Twitteratti |
4. Wiki score > Developer score and Wiki score > Marketing score | |
4.1) Any number of Wiki Edits | Strunk & White |
Karma Rank
It shows the user's rank on Connect based on user's total score. The ranks are not affected by developer or marketing type contribution, it is a pure comparison of score in numerical terms. Since rank updation is a part of the cron script, hence ranks are updated every 5 minutes.
Users should aim to increase their score so as to gain a higher rank. The contributors of user rank are
- Developer score - Bugzilla bug fixing score + OBS commit score
- Marketing score - Twitter tweet score + Planet openSUSE posts score
- Wiki score - Score on making wiki entries or edits.
- Kudos - Awarded by other Connect users.
Kudos
Users can show their appreciation of other user's contribution to openSUSE by sending across kudos. Kudos add to the total score of a user. Each kudos add a single point to the total score. But there is a limit to which a user can give kudos daily. A user can give maximum of 2 or whatever integral multiple of 500 their total score is.
An 'Extend your Kudos' is visible on every user's profile, except your own. Clicking on the button adds a kudo to the user's points.
Badge Suggestion
Karma widget shows exactly why a particular badge was awarded to the user.
Integration with the API
The karma plugin is integrated with Connect's API. The method karma.details fetches the score in each respect. for eg. http://connect.opensuse.org/services/api/rest/xml/?method=karma.details&username=priyanka_m
fetches the result set
<elgg> <status type="integer">0</status> <result type="array"> <badge type="string">SUSE Herald</badge> <developer_score type="array"> <bugzilla_score type="integer">0</bugzilla_score> <build_service_score type="integer">0</build_service_score> </developer_score> <marketing_score type="array"> <twitter_score type="integer">0</twitter_score> <planet_opensuse_score type="integer">60</planet_opensuse_score> </marketing_score> <wiki_score type="integer">4</wiki_score> <karma_last_update type="string">15-08-2012 18:00:18</karma_last_update> </result> </elgg>
This method requires API authentication.