Difference between revisions of "Ratings"

From Sega Retro

(16 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
!Source
 
!Source
 
|-
 
|-
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|null}}{{#vardefine: newrow|false}}
+
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}{{#vardefine: lastargtype|null}}{{#vardefine:thisIsARating|true}}
 
{{#forargs:
 
{{#forargs:
 
| key
 
| key
Line 26: Line 26:
 
|}}
 
|}}
 
}}
 
}}
 +
 +
<!-- -->
 +
{{#ifeq: {{#var: argtype}}|score|{{#ifeq: {{#var: lastargtype}}|score|
 +
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|0|noissuename=yes|nopubdate=yes}}}}
 +
{{RatingsRowSum|{{#var: magnamelong}}|{{#var: argpubscore}}|{{#var: argpubsource}}}}[[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}}
 
|}}
 
|}}
 +
{{#vardefine: lastargtype|{{#var: argtype}}}}
 
</span>
 
</span>
 
 
{{#ifeq: {{#var: newrow}}|true|
 
{{#ifeq: {{#var: newrow}}|true|
 
{{#ifeq: {{#var: argpubname}}|null||
 
{{#ifeq: {{#var: argpubname}}|null||
 
{{#ifeq: {{#var: argpubscore}}|null||
 
{{#ifeq: {{#var: argpubscore}}|null||
{{OnlineRatingTest|argpubname}}
+
 
 
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|0|noissuename=yes|nopubdate=yes}}}}
 
{{#vardefine:magnamelong|{{MagazineName|{{#var: argpubname}}|0|noissuename=yes|nopubdate=yes}}}}
 
{{RatingsRowSum|{{#var: magnamelong}}|{{#var: argpubscore}}|{{#var: argpubsource}}}}
 
{{RatingsRowSum|{{#var: magnamelong}}|{{#var: argpubscore}}|{{#var: argpubsource}}}}
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|null}}{{#vardefine: newrow|false}}
+
{{#vardefine:argpubname|null}}{{#vardefine:argpubscore|null}}{{#vardefine:argpubsource|}}{{#vardefine: newrow|false}}
 
|}}
 
|}}
 
}}
 
}}
 
}}
 
}}
 
}}
 
}}
 
  
 
<!-- Calculate average -->
 
<!-- Calculate average -->
Line 56: Line 62:
 
! 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}}
 
|-
 
|-
|colspan="2" style="padding:2px; text-align:center; line-height:initial" | <small>Based on<br>'''{{#var: totalReviews}}''' review{{#ifexpr: {{#var: totalReviews}} > 1|s| }}</small>
+
|colspan="2" style="padding:2px; text-align:center; line-height:initial" | <small>{{#vardefine:totalText|Based on<br>'''{{#var: totalReviews}}''' review{{#ifexpr: {{#var: totalReviews}} > 1|s| }}}}{{#var:totalText}}</small>
 
|}
 
|}
 
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
 
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
Line 65: Line 71:
 
<meta itemprop="bestRating" content="100">
 
<meta itemprop="bestRating" content="100">
 
<meta itemprop="worstRating" content="0">
 
<meta itemprop="worstRating" content="0">
</div><noinclude>
+
</div>{{#vardefine:thisIsARating|false}}<includeonly>{{#cargo_store:
 +
_table = ratings_table
 +
|name = {{#titleparts:{{PAGENAME}}}}
 +
|console={{{icon}}}
 +
|average = {{#var: average}}
 +
|totalReviews = {{#var: totalReviews}}
 +
}}</includeonly><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 13:28, 7 November 2017

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

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

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.