Extension talk:Contribution Scores

From MediaWiki.org
Jump to: navigation, search
Start a new discussion

Contents

Thread titleRepliesLast modified
I can't get this to work in 1.16216:55, 23 January 2013
Namespace Filtering114:37, 16 October 2012
Critical: Does not work in 1.18023:57, 2 October 2012
Titles are garbled 1.19.1 218:33, 28 September 2012
Usernames don't appear in 1.17.5019:52, 2 July 2012
Unrecognised punctuation character100:56, 16 June 2012
Reset Users Scores213:45, 13 March 2012
1.15 - german translation of formula is wrong421:24, 24 January 2012
Disable score definition?219:11, 5 January 2012
MW 1.18 / Contribution Scores119:07, 5 January 2012
Show real name or e-mail instead of username?109:53, 5 January 2012
Return formatted numbers109:08, 5 January 2012
Correction of table109:07, 5 January 2012
Excluding persons from contribution scores108:39, 5 January 2012
formatNum108:36, 5 January 2012
User Scores by Group 006:11, 5 January 2012
Does not work with SQLite006:11, 5 January 2012
code changes to add new metric "Pages created"006:08, 5 January 2012
Wonderful Extension006:07, 5 January 2012
List of "User --- Pages"006:06, 5 January 2012
First page
First page
Previous page
Previous page
Last page
Last page

I can't get this to work in 1.16

Hi,

This extension is failing to work in 1.16.

It's failing on a call to getOutput() that seems to have been added in the 1.18 release of mediawiki.

Is there an older SVN revision you can point me to that will work with 1.16?

195.212.29.9016:30, 23 January 2013

The REL1_16 branch didn't go anywhere. :)

You should really upgrade, though. Since 1.17 you don't even need command line and it's a single step to 1.20. ;-)

Nemo16:49, 23 January 2013

Thanks very much.

I will upgrade when I find the time to test everything :-)

195.212.29.9016:55, 23 January 2013
 
 

Namespace Filtering

This is a nice extension that has motivated my users to contribute. Unfortunately the scores are bloated by image uploads which each count as a page. Could you please add an option to limit or include only certain namespaces, for example Main only, or excluding File namespace. I think this would be an easy addition to the SQL as the field is in the page table.

—The preceding unsigned comment was added by an unknown user on a unknown date.06:06, 5 January 2012

Bumping this since I also would love to exclude a certain namespace from the scores.
Does anyone know how to do this? I'm not familiar with MySQL yet...

Stefahn (talk)14:37, 16 October 2012
 

Critical: Does not work in 1.18

With enabled $wgShowSQLErrors in LocalSettings.php:

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:


SELECT user_id, user_name, page_count, rev_count, page_count+SQRT(rev_count-page_count)*2 AS wiki_rank FROM user u JOIN ((SELECT rev_user, COUNT(DISTINCT rev_page) AS page_count, COUNT(rev_id) AS rev_count FROM revision WHERE rev_timestamp > '20120925235315' AND rev_user NOT IN (SELECT ipb_user FROM ipblocks WHERE ipb_user <> 0) AND rev_user NOT IN (SELECT ug_user FROM user_groups WHERE ug_group='bot') GROUP BY rev_user ORDER BY page_count DESC LIMIT 50) UNION (SELECT rev_user, COUNT(DISTINCT rev_page) AS page_count, COUNT(rev_id) AS rev_count FROM revision WHERE rev_timestamp > '20120925235315' AND rev_user NOT IN (SELECT ipb_user FROM ipblocks WHERE ipb_user <> 0) AND rev_user NOT IN (SELECT ug_user FROM user_groups WHERE ug_group='bot') GROUP BY rev_user ORDER BY rev_count DESC LIMIT 50)) s ON (user_id=rev_user) ORDER BY wiki_rank DESC LIMIT 50


from within function "". Database returned error "1: near "UNION": syntax error".

86.61.12.12523:57, 2 October 2012

Titles are garbled 1.19.1

Hi I am using this extension and I get garbled titles (image below), and the special page listing in "version" doesn't say "Contribution Scores" it says '&lt contributionscores &gt (characters are omitted so it displays in this post)


Here is a picture http://img820.imageshack.us/img820/6186/screenshot20120701at934.png

MW 1.19.1

Thank you 24.130.249.87

24.130.249.8716:38, 1 July 2012

Having a similar issue MW 1.18.0, but not 1.18.2...

134.174.110.2513:54, 15 August 2012

That usually means that you're lacking the corresponding System messages.

Nemo18:33, 28 September 2012
 
 

Usernames don't appear in 1.17.5

I noticed that UserNames aren't appearing in 1.17.5 for me. I added an image http://img444.imageshack.us/img444/5271/screenshot20120701at818.png

Thank you 207.47.18.254 19:52, 2 July 2012 (UTC)

207.47.18.25419:52, 2 July 2012

Unrecognised punctuation character

* {{PLURAL:{{#cscore:SomeUser|changes}}|change|changes}} (should return "change" if user has 1 edit)
* {{#ifeq:{{#cscore:SomeUser|changes}}|1|change|changes}} (should return "change" if user has 1 edit)
* {{#ifexpr: {{#cscore:SomeUser|changes}} > 2 | 2+ | 0 or 1 }}

The output of #cscore cannot be used for further parsing.

--Subfader 19:04, 1 July 2011 (UTC)06:10, 5 January 2012

To add further parsing you should modify the last line of the file ContributionScores.php

return $parser->insertStripItem($output, $parser->mStripState);

TO

return $output; 

Naturally it is not a secure or good solution if you want to use this extension, but if your purpose is to use the additional parsing then it is enough.

Neoshinji (talk)00:56, 16 June 2012
 

Reset Users Scores

Is there anyway to reset the contribution scores?

—The preceding unsigned comment was added by an unknown user on a unknown date.05:43, 5 January 2012

Only by resetting the edit counts for all users.

siebrand09:58, 5 January 2012

How is this possible? Is it possible for "single" users or only for all wiki-users at the same?

Backgrund: I need to hide some users in the "Top-Scores" because they are Admins and the list should show only "normal" users.

Thanks.

62.154.222.23513:45, 13 March 2012
 
 

1.15 - german translation of formula is wrong

Just as the title says. Please re-transate and fix. Schmelzle 21:39, 23 January 2012 (UTC)

Schmelzle21:39, 23 January 2012

Correct formula explanation would read: "Bewertung = (Anzahl der bearbeiteten Seiten) + 2 * Quadratwurzel aus ((Anzahl der Bearbeitungen) - (Anzahl der bearbeiteten Seiten))". Hope this helps.

Schmelzle08:38, 24 January 2012

Would help if you post the title of the message.

Subfader15:00, 24 January 2012

It is the translation for 'contributionscores-info'. I changed this in my installation to a proper translated explanation:

'contributionscores-info' => 'Für diese Statistik wird folgendes Bewertungsschema angewandt:

Bewertung = (Anzahl der bearbeiteten Seiten) + 2 * Quadratwurzel aus ((Anzahl der Bearbeitungen) - (Anzahl der bearbeiteten Seiten))

Die Bewertungen auf dieser Grundlage gewichten die Vielfalt der Mitarbeit höher als das reine Beitragsvolumen.',

Schmelzle17:46, 24 January 2012
 
 
 

Disable score definition?

I don't think the score definition is fair. E.g. I have 54470 changes on 33365 pages - score: 33656. Is it possible to use a plain average instead?

--Subfader 11:44, 4 June 2009 (UTC)06:04, 5 January 2012

Another odd one: 5 changes on 3 pages = score 6 huh?

--Subfader 00:31, 9 June 2009 (UTC)06:05, 5 January 2012
 

MW 1.18 / Contribution Scores

Edited by 0 users.
Last edit: 06:11, 5 January 2012

There appears to be no errors, however the extension never updates after edits.

—The preceding unsigned comment was added by an unknown user on a unknown date.06:11, 5 January 2012

Cache? Turn on erorr reports, see Manual:How to debug

Subfader19:07, 5 January 2012
 

Show real name or e-mail instead of username?

Hi! I would like to use this extension on our company wiki because it seems great, but unfortunately our usernames must corespond to our user-ID so our toplist would look something like...

  • AA1984
  • AB8373
  • BA8308
  • etc...

This would make it impossible to know who has contributed and I believe the point with the extension would be lost. =/
Is there a possibility to use the column "real name" or "e-mail" instead of username? Thanks!

--P.Nilsson 08:52, 23 February 2010 (UTC)06:08, 5 January 2012

In Special:Code/MediaWiki/108127, Special:Code/MediaWiki/108128, Special:Code/MediaWiki/108129 I made changes to make this possible. It requires the latest versions of the extension and MediaWiki 1.19 alpha or later.

siebrand09:53, 5 January 2012
 

Return formatted numbers

The extension should return formatted numbers, i.e. 12,365 instead of 12365. It's an easy fix:

  • replace $row->page_count with number_format($row->page_count) (4 times for "pages" and "changes")
  • replace round($row->wiki_rank,0) with number_format(round($row->wiki_rank,0)) (2 times for "score")

in ContributionScores.php and ContributionScores_body.php

--Subfader 13:15, 26 February 2010 (UTC)06:08, 5 January 2012

When did you download this extension. As far as I can tell, all the displayed numbers are localised.

siebrand09:08, 5 January 2012
 

Correction of table

The cells inside the tr tag should be th's, not td's:

                $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n".
                        "<tr class='header'>\n".
                        "<th>" . wfMsgHtml( 'contributionscores-score' ) . "</th>\n" .
                        "<th>" . wfMsgHtml( 'contributionscores-pages' ) . "</th>\n" .
                        "<th>" . wfMsgHtml( 'contributionscores-changes' ) . "</th>\n" .
                        "<th>" . wfMsgHtml( 'contributionscores-username' ) . "</th>\n";
--Subfader 18:43, 5 June 2011 (UTC)06:09, 5 January 2012

They are, aren't they?

I did some minor refactoring in Special:Code/MediaWiki/108121.

siebrand09:07, 5 January 2012
 

Excluding persons from contribution scores

Is it possible to exclude persons/groups etc from the list? I read on mixed db's wiki that the bots have been excluded but how?

Thomas 84.243.24.18 12:07, 10 June 2011 (UTC)06:09, 5 January 2012

There are only two settings for LocalSettings.php that will exclude certain users (bots and blocked users):

$wgContribScoreIgnoreBots = true;          // Exclude Bots from the reporting - Can be omitted.
$wgContribScoreIgnoreBlockedUsers = true;  // Exclude Blocked Users from the reporting - Can be omitted.
siebrand08:39, 5 January 2012
 

You forgot $wgLang->formatNum();.

--Subfader 03:29, 13 June 2011 (UTC)06:10, 5 January 2012

Where exactly? Looks to me like all the numbers are correctly localised: https://translatewiki.net/wiki/Special:ContributionScores?uselang=hi

siebrand08:36, 5 January 2012
 

User Scores by Group

Would it be possible to display scores of certain groups only (say Administrators)? My wiki currently has many different groups and it would be great to be able to display the top scores of each group.

Nicholas --64.126.15.20 20:56, 23 August 2011 (UTC)06:11, 5 January 2012

Does not work with SQLite

When using the extension with the SQLite database backend i get an SQL error.

 „1: near "UNION": syntax error“.

Maybe SQLite is not aware of union statements?

--Pintman 11:54, 18 August 2011 (UTC)06:11, 5 January 2012

code changes to add new metric "Pages created"

Had a little programming fun and implemented the new metric Page Creations (for MW 1.13). Only new pages created with a minimum of 256Bytes will count, in order to avoid having Users try to boost their score by creating lots of empty pages. As well file uploads are logged as 0 length new page creations. I'd rather not have those count either.

Note: I use a different formula than the one that was precoded. I'm not much of a sql wizard. And never used php before. So be weary of this code ;-)


ContributionScores.php: these changes will add a new metric {{#cscore:Rst|pagecreations}} and change how the score metric is calculated.

              if ($metric=='score') {
                       $res = $dbr->select('revision',
                                                                       'COUNT(DISTINCT rev_page)+(COUNT(rev_id)-COUNT(DISTINCT rev_page))/2 AS wiki_rank',
                                                                       array('rev_user' => $user->getID()));
                       $row = $dbr->fetchObject($res);
                       $wiki_rank = $row->wiki_rank;
                       $userid = $user->getID();
                       $res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}");
                       $row = $dbr->fetchObject($res);
                       $wiki_rank = $wiki_rank + $row->pagecreation_count/2;
                       $output = round($wiki_rank,0);
               } elseif ($metric=='pagecreations') {
                       $userid = $user->getID();
                       $res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}");
                       $row = $dbr->fetchObject($res);
                       $output = $row->pagecreation_count;
               }


ContributionScores_body.php: these changes will add new column Pages Created to the Lists:

               $sqlMostNewPages = "SELECT rev_user,
                                                 COUNT(DISTINCT rev_page) AS newpage_count
                                                 FROM {$revTable}
                                                 {$sqlWhere} AND rev_parent_id=0 AND rev_len > 256
                                                 GROUP BY rev_user
                                                 ORDER BY newpage_count DESC
                                                 LIMIT {$limit}";
                $sqltmp =  "SELECT user_id, " .
                                                "user_name, " .
                                                "page_count, " .
                                                "rev_count " .
                                                "FROM $userTable u JOIN (($sqlMostPages) UNION ($sqlMostRevs)) s ON (user_id=rev_user) " .
                                                "LIMIT $limit";

                $sql =  "SELECT res1.user_id, " .
                                                "res1.user_name, " .
                                                "res1.page_count, " .
                                                "res2.newpage_count, " .
                                                "res1.rev_count, " .
                                                "res1.page_count+(res1.rev_count-res1.page_count)/2 + res2.newpage_count/2 AS wiki_rank " .
                                                "FROM ( ($sqltmp) as res1, ($sqlMostNewPages) as res2 ) " .
                                                "WHERE res1.user_id=res2.rev_user ORDER BY wiki_rank DESC " .
                                                "LIMIT $limit";

               $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n".
                        "<tr class='header'>\n".
                        "<td>" . wfMsgHtml( 'contributionscores-score' ) . "</td>\n" .
                        "<td>" . wfMsgHtml( 'contributionscores-pages' ) . "</td>\n" .
                        "<td>" . wfMsgHtml( 'contributionscores-changes' ) . "</td>\n" .
                        "<td>" . wfMsgHtml( 'contributionscores-newpages' ) . "</td>\n" .
                        "<td>" . wfMsgHtml( 'contributionscores-username' ) . "</td>\n";

               $output .= "</tr><tr class='{$altrow}'>\n<td class='content'>" .
                                round($row->wiki_rank,0) . "\n</td><td class='content'>" .
                                $row->page_count . "\n</td><td class='content'>" .
                                $row->rev_count . "\n</td><td class='content'>" .
                                $row->newpage_count . "\n</td><td class='content'>" .
                                $skin->userLink( $row->user_id, $row->user_name );


ContributionScores.i18n.php: only showing en changes:

$messages['en'] = array(
        'contributionscores'                 => 'Contribution scores',
        'contributionscores-desc'            => 'Polls the wiki database for highest [[Special:ContributionScores|user contribution volume]]',
        'contributionscores-info'            => "Scores are calculated as follows:
*One (1) point for each unique page edited
*(total edits made - total unique pages) / 2
*Half a point for each newly created Page with content
Scores calculated in this manner weight edit diversity over edit volume.
Basically, this score measures primarily unique pages edited, with consideration for high edit volume - assumed to be a higher quality page.",
        'contributionscores-top'             => '(Top $1)',
        'contributionscores-days'            => 'Last $1 days',
        'contributionscores-allrevisions'    => 'All revisions',
        'contributionscores-score'           => 'Score',
        'contributionscores-pages'           => 'Pages',
        'contributionscores-changes'         => 'Changes',
        'contributionscores-newpages'        => 'Page creations',
        'contributionscores-username'        => 'Username',
        'contributionscores-invalidusername' => 'Invalid username',
        'contributionscores-invalidmetric'   => 'Invalid metric',
);
—The preceding unsigned comment was added by an unknown user on a unknown date.06:08, 5 January 2012

Wonderful Extension

Really like it a lot. Had a quick look at the mysql database and came up with two potentially useful/interesting additions that could be made rather easily:

  • Number of new Pages created (while in populating your wiki stage could be boosted in the score calculation)
 select count(*) from revision where user_id=x and rev_parent_id=0;
  • Total number of characters added (pseudo_code)
 Sum_all-revisions-of-user-X( (rev_len(current revision) - rev_len(parent revision) )

In addition I'd think it would be neat if the formula for the Contribution Score could include those values and be changed in either LocalSettings.php or via a Special:ContributionScoreFormula page. Scores really get people hooked and changing the formula helps steer users in the direction you want the wiki to take.

—The preceding unsigned comment was added by an unknown user on a unknown date.06:07, 5 January 2012

List of "User --- Pages"

Thanks for the great extension. Would it be possible to alter the extension to show a table of:

User        Pages edited          Date of last edit
----        ------------          -----------------
Jonathan    dfjsdflskjf           1/2/08
            sdkfljsfljsdfslkj     1/5/09
            sdflkjdflsfj          1/1/09
Andrew      sdsdflkjsdfljk        5/4/02
            sdflkjsflksjf         5/5/09
(etc)

My wiki is quite small so I wouldn't be worried if it involved a lot of SQL queries!

Also, would it be possible to ignore a particular editor (me) who has done nearly all the pages?

Many thanks

Jonathan3 18:09, 31 August 2009 (UTC)06:06, 5 January 2012
First page
First page
Previous page
Previous page
Last page
Last page