Karma plugin for openSUSE Connect
Developer: Priyanka Menghani
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.
Karma has the following features-
Count your Bugs
Count your OBS commits
Count your Planet openSUSE posts
Count your Tweets
Count your Wiki Edits
Integral Part of the Karma Plugin
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.
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?
The karma widget available from the widget gallery shows user's karma details. The following are shown by the karma widget
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
|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|
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.
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.
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.