Difference between revisions of "Ratings"

From Sega Retro

(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine:totalReviews|0}}{{#vardefine:cumulativeScore|0}}
+
{{#if:{{{icon|}}}||<div style="display:none;">}}{{#vardefine:totalReviews|0}}{{#vardefine:cumulativeScore|0}}
 
{|cellpadding="0" cellspacing="0" class="breakout mw-collapsible mw-collapsed" style="width:auto !important; max-width: 320px; float: right; margin-left: 0px; display: inline; position: relative;"
 
{|cellpadding="0" cellspacing="0" class="breakout mw-collapsible mw-collapsed" style="width:auto !important; max-width: 320px; float: right; margin-left: 0px; display: inline; position: relative;"
 
!style="height:39px;" |Sega Retro Average&nbsp;
 
!style="height:39px;" |Sega Retro Average&nbsp;
Line 8: Line 8:
 
!class="sortable"|Score
 
!class="sortable"|Score
 
!Source
 
!Source
|-
 
 
|-
 
|-
 
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}{{#vardefine: lastargtype|null}}{{#vardefine:thisIsARating|true}}
 
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}{{#vardefine: lastargtype|null}}{{#vardefine:thisIsARating|true}}
Line 21: Line 20:
 
{{#vardefine: key|{{#replace:{{#var:key}}|_4|}}}}
 
{{#vardefine: key|{{#replace:{{#var:key}}|_4|}}}}
  
 +
<!-- Determine which argument we're dealing with (icon, pubname, pubscore etc.) -->
 
{{#vardefine:argtype|score}}
 
{{#vardefine:argtype|score}}
 
{{#ifeq: {{#var: key}}|icon|{{#vardefine:argtype|icon}}|
 
{{#ifeq: {{#var: key}}|icon|{{#vardefine:argtype|icon}}|
Line 30: Line 30:
 
<!-- -->
 
<!-- -->
 
{{#ifeq: {{#var: argtype}}|score|{{#ifeq: {{#var: lastargtype}}|score|
 
{{#ifeq: {{#var: argtype}}|score|{{#ifeq: {{#var: lastargtype}}|score|
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|0|noissuename=yes|nopubdate=yes}}}}
+
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|noissuename=yes|nopubdate=yes}}}}
 
+
{{RatingsRowSum|{{#var: magnamelong}}|{{#var: argpubscore}}|{{#var: argpubsource}}}}[[Category:Rating without source]][[Category:Rating without source ({{#var:argpubname}})]]
{{ #if: {{#var: argpubscore}} | {{!}}<span itemprop="author">{{#var: magnamelong}}</span>{{addvar|cumulativeScore|{{#var: argpubscore}}}}{{incvar|totalReviews}}
+
|}}|}}  
{{!}}style="padding-left:5px; text-align:center; {{scoreColour|{{#var: argpubscore}}}}" width="20px" {{!}}<span itemprop="ratingValue">{{#var: argpubscore}}</span>
 
{{!}} {{#if: {{#var: argpubsource}} | {{#var: argpubsource}} | [[Category:Rating without source]] }}
 
{{!}}-
 
| }}
 
[[Category:Rating without source]]
 
|}}|}}
 
 
 
  
 
{{#ifeq: {{#var: argtype}}|score|{{#vardefine:argpubname|{{#var: key}}}}{{#vardefine:argpubscore|{{#var: value}}}}|}}
 
{{#ifeq: {{#var: argtype}}|score|{{#vardefine:argpubname|{{#var: key}}}}{{#vardefine:argpubscore|{{#var: value}}}}|}}
 
{{#ifeq: {{#var: argtype}}|source|{{#vardefine:argpubsource|{{#var: value}}}}
 
{{#ifeq: {{#var: argtype}}|source|{{#vardefine:argpubsource|{{#var: value}}}}
{{#vardefine: newrow|true}}
+
{{#vardefine: newrow|true}}{{#if:{{#pos:{{#var: argpubsource}}|http|}}|[[Category:External rating reference]]|}}
 
|}}
 
|}}
 
{{#vardefine: lastargtype|{{#var: argtype}}}}
 
{{#vardefine: lastargtype|{{#var: argtype}}}}
Line 50: Line 43:
 
{{#ifeq: {{#var: argpubname}}|null||
 
{{#ifeq: {{#var: argpubname}}|null||
 
{{#ifeq: {{#var: argpubscore}}|null||
 
{{#ifeq: {{#var: argpubscore}}|null||
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|0|noissuename=yes|nopubdate=yes}}}}
 
 
{{ #if: {{#var: argpubscore}} | {{!}}<span itemprop="author">{{#var: magnamelong}}</span>{{addvar|cumulativeScore|{{#var: argpubscore}}}}{{incvar|totalReviews}}
 
{{!}}style="padding-left:5px; text-align:center; {{scoreColour|{{#var: argpubscore}}}}" width="20px" {{!}}<span itemprop="ratingValue">{{#var: argpubscore}}</span>
 
{{!}} {{#if: {{#var: argpubsource}} | {{#var: argpubsource}} | [[Category:Rating without source]] }}
 
{{!}}-
 
| }}
 
  
 +
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|noissuename=yes|nopubdate=yes}}}}
 +
{{RatingsRowSum|{{#var: magnamelong}}|{{#var: argpubscore}}|{{#var: argpubsource}}}}
 
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}
 
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}
 
|}}
 
|}}
Line 72: Line 60:
 
|}
 
|}
 
{|cellpadding="0" cellspacing="0" class="breakout" style="width:auto !important; float: right; margin-left: 15px; display: inline; position: relative;"
 
{|cellpadding="0" cellspacing="0" class="breakout" style="width:auto !important; float: right; margin-left: 15px; display: inline; position: relative;"
! style="max-width:40px; height:40px"| {{{{{icon}}}|L}}{{#if: {{{icon|}}} |  | [[Category:Old Ratings Template]]}}
+
! style="max-width:40px; height:40px"| {{{{{icon}}}|L}}
 
! style="max-width:40px;" style="font-size:16pt; {{scoreColour|{{#var: average}}}}"|{{#var: average}}
 
! style="max-width:40px;" style="font-size:16pt; {{scoreColour|{{#var: average}}}}"|{{#var: average}}
 
|-
 
|-
Line 84: Line 72:
 
<meta itemprop="bestRating" content="100">
 
<meta itemprop="bestRating" content="100">
 
<meta itemprop="worstRating" content="0">
 
<meta itemprop="worstRating" content="0">
</div>{{#vardefine:thisIsARating|false}}<noinclude>
+
</div>{{#vardefine:thisIsARating|false}}<includeonly>{{#cargo_store:
 +
_table = ratings_table
 +
|name = {{#titleparts:{{PAGENAME}}}}
 +
|console={{{icon}}}
 +
|average = {{#var: average}}
 +
|totalReviews = {{#var: totalReviews}}
 +
}}</includeonly>{{#if:{{{icon|}}}|[[Category:Update ratings template]]|</div>{{Ratings2|{{{1|}}}|{{{2|{{#titleparts:{{PAGENAME}}}}}}}}}}}<noinclude>{{#cargo_declare:
 +
_table = ratings_table
 +
|name=Page
 +
|console=Text
 +
|average=Integer
 +
|totalReviews=Integer
 +
}}
 
==Usage==
 
==Usage==
 
This template is to be used on articles about video games and will display scores awarded to said games by video game magazines/websites.  
 
This template is to be used on articles about video games and will display scores awarded to said games by video game magazines/websites.  

Revision as of 14:23, 17 July 2020

Sega Retro Average 
Publication Score Source
{{{{{icon}}}|L}} Division by zero.
Based on
0 review

<meta itemprop="ratingValue" content="Division by zero.">

Sega Retro Average 
Publication Version Score
{{|L}} N/A
Based on
0 reviews

Ratings

This template defines the table "ratings_table". View table.

Usage

This template is to be used on articles about video games and will display scores awarded to said games by video game magazines/websites.

Usage:

{{Ratings
| icon=
| publication=
}}

Substitute "publication" with a publication code to get the desired result.

for sources, add "_source", e.g.

| smf_source=[http://www.google.com]
| vgce_source={{num|32|page=10/11}}

All fields are optional.