Difference between revisions of "ConvertRating"

From Sega Retro

Line 1: Line 1:
 
<includeonly>{{#vardefine:system|{{{1|}}}}}{{#vardefine:value|{{{2|}}}}}
 
<includeonly>{{#vardefine:system|{{{1|}}}}}{{#vardefine:value|{{{2|}}}}}
 
{{#switch:{{#var:system}}
 
{{#switch:{{#var:system}}
|0-4s={{#switch:{{#var:value}}
+
|0-4s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|4}}}}{{#vardefine:score|{{#expr:{{#var:value}}*25}}}}
|0={{#vardefine:displayRating|☆☆☆☆}}{{#vardefine:score|0}}
 
|1={{#vardefine:displayRating|★☆☆☆}}{{#vardefine:score|25}}
 
|2={{#vardefine:displayRating|★★☆☆}}{{#vardefine:score|50}}
 
|3={{#vardefine:displayRating|★★★☆}}{{#vardefine:score|75}}
 
|4={{#vardefine:displayRating|★★★★}}{{#vardefine:score|100}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|1-4s={{#switch:{{#var:value}}
 
|1-4s={{#switch:{{#var:value}}
Line 14: Line 7:
 
}}
 
}}
  
|0-5s={{#switch:{{#var:value}}
+
|0-5s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|5}}}}{{#vardefine:score|{{#expr:{{#var:value}}*20}}}}
|0={{#vardefine:displayRating|☆☆☆☆☆}}{{#vardefine:score|0}}
 
|1={{#vardefine:displayRating|★☆☆☆☆}}{{#vardefine:score|20}}
 
|2={{#vardefine:displayRating|★★☆☆☆}}{{#vardefine:score|40}}
 
|3={{#vardefine:displayRating|★★★☆☆}}{{#vardefine:score|60}}
 
|4={{#vardefine:displayRating|★★★★☆}}{{#vardefine:score|80}}
 
|5={{#vardefine:displayRating|★★★★★}}{{#vardefine:score|100}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|1-5s={{#switch:{{#var:value}}
 
|1-5s={{#switch:{{#var:value}}

Revision as of 04:02, 20 April 2020

Clock.svg
This task is unfinished
This is a wiki task that requires more thought or peer review. An important issue that needs to be solved, which will appear at the top of Sega Retro:Todo until this message is removed.

A template for converting a rating, as printed in a magazine into:

  • something nice to display ({{#var:displayRating}})
  • a value out of 100 for use in Sega Retro averages ({{#var:score}})


multiple instances of the above (e.g. support "1,2,3,4" for EGM)

added text. e.g. later issues of the UK Official Dreamcast magazine, 7 = "good".


it should be able to detect if a given value is invalid. Some magazines could be using multiple systems depending on context.

The user should not be expected to calculate anything.


Working values

0-4s

0 0/40/40/40/4 0
1 1/41/41/41/4 25
2 2/42/42/42/4 50
3 3/43/43/43/4 75
4 4/44/44/44/4 100