Extension talk:Contribution Scores
Contents
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |
Just as the title says. Please re-transate and fix. Schmelzle 21:39, 23 January 2012 (UTC)
Correct formula explanation would read: "Bewertung = (Anzahl der bearbeiteten Seiten) + 2 * Quadratwurzel aus ((Anzahl der Bearbeitungen) - (Anzahl der bearbeiteten Seiten))". Hope this helps.
Would help if you post the title of the message.
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.',
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?
Another odd one: 5 changes on 3 pages = score 6 huh?
There appears to be no errors, however the extension never updates after edits.
Cache? Turn on erorr reports, see Manual:How to debug
Is there anyway to reset the contribution scores?
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!
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.
The extension should return formatted numbers, i.e. 12,365 instead of 12365. It's an easy fix:
- replace
$row->page_countwithnumber_format($row->page_count)(4 times for "pages" and "changes") - replace
round($row->wiki_rank,0)withnumber_format(round($row->wiki_rank,0))(2 times for "score")
in ContributionScores.php and ContributionScores_body.php
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";
They are, aren't they?
I did some minor refactoring in Special:Code/MediaWiki/108121.
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?
You forgot $wgLang->formatNum();.
Where exactly? Looks to me like all the numbers are correctly localised: https://translatewiki.net/wiki/Special:ContributionScores?uselang=hi
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.
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?
* {{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.
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',
);
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.
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.
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
Has anyone got this to work on mediawiki 1.15?
Incase anyone else is wondering, it works
I think the .contributionscores.odd {} is broken in MW 1.14.
This looks like a great extension. I haven't tried it in my own wiki yet, but I've played with it in the sandbox of another wiki that has it. I would like to be able to specify which columns are shown in the output, though, because my users are only interested in the final score, not pages or changes. Could you make options for that?
I thought that if no column options were given, then the display would be as it is now. If options for one or more of the three numeric columns is given, those columns and the name column would be shown. The name column would always be shown. The options could be named scorecolumn, pagescolumn, and changescolumn. To get a able of the top 20 scores in a wiki, but not show pages or changes, one could use:
{{Special:ContributionScores/15/7/scorecolumn}}
Also, is there a way to specify options without specifying a number of days, the "7" in this example?
In file ContributionScores_body.php, line 182, after this:
if ( is_null( $days ) || $days < 0 ) $days = 7;
Add this:
if ( $days=='m' ) $days = date('j');
In this case, if you call with Special:ContributionScores/50/m, m will be replaced with the current day of the month, so you will get a table of most active users this month.
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |



