Difference between revisions of "ConvertRating"

From Sega Retro

Line 3: Line 3:
 
|0-4s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|4}}}}{{#vardefine:score|{{#expr:{{#var:value}}*25}}}}
 
|0-4s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|4}}}}{{#vardefine:score|{{#expr:{{#var:value}}*25}}}}
  
|1-4s={{#switch:{{#var:value}}
+
|1-4s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|4}}}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*(100/3)}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-5s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|5}}}}{{#vardefine:score|{{#expr:{{#var:value}}*20}}}}
 
|0-5s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|5}}}}{{#vardefine:score|{{#expr:{{#var:value}}*20}}}}
  
|1-5s={{#switch:{{#var:value}}
+
|1-5s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|5}}}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*25}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-10s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|10}}}}{{#vardefine:score|{{#expr:{{#var:value}}*10}}}}
 
|0-10s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|10}}}}{{#vardefine:score|{{#expr:{{#var:value}}*10}}}}
  
|1-10s={{#switch:{{#var:value}}
+
|1-10s={{#vardefine:displayRating|{{StarRating|{{#var:value}}|10}}}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*(100/9)}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-4={{#vardefine:displayRating|{{#var:value}}/4}}{{#vardefine:score|{{#expr:{{#var:value}}*25}}}}
 
|0-4={{#vardefine:displayRating|{{#var:value}}/4}}{{#vardefine:score|{{#expr:{{#var:value}}*25}}}}
  
|1-4={{#switch:{{#var:value}}
+
|1-4={{#vardefine:displayRating|{{#var:value}}/4}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*(100/3)}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-5={{#vardefine:displayRating|{{#var:value}}/5}}{{#vardefine:score|{{#expr:{{#var:value}}*20}}}}
 
|0-5={{#vardefine:displayRating|{{#var:value}}/5}}{{#vardefine:score|{{#expr:{{#var:value}}*20}}}}
  
|1-5={{#switch:{{#var:value}}
+
|1-5={{#vardefine:displayRating|{{#var:value}}/5}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*25}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-10={{#vardefine:displayRating|{{#var:value}}/10}}{{#vardefine:score|{{#expr:{{#var:value}}*10}}}}
 
|0-10={{#vardefine:displayRating|{{#var:value}}/10}}{{#vardefine:score|{{#expr:{{#var:value}}*10}}}}
  
|1-10={{#switch:{{#var:value}}
+
|1-10={{#vardefine:displayRating|{{#var:value}}/10}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*(100/9)}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-20={{#vardefine:displayRating|{{#var:value}}/20}}{{#vardefine:score|{{#expr:{{#var:value}}*5}}}}
 
|0-20={{#vardefine:displayRating|{{#var:value}}/20}}{{#vardefine:score|{{#expr:{{#var:value}}*5}}}}
  
|1-20={{#switch:{{#var:value}}
+
|1-20={{#vardefine:displayRating|{{#var:value}}/20}}{{#vardefine:score|{{#expr:({{#var:value}}-1)*(100/19)}}}}
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
  
 
|0-100={{#vardefine:displayRating|{{#var:value}}%}}{{#vardefine:score|{{#var:value}}}}
 
|0-100={{#vardefine:displayRating|{{#var:value}}%}}{{#vardefine:score|{{#var:value}}}}
Line 48: Line 34:
  
 
|A-F={{#switch:{{#var:value}}
 
|A-F={{#switch:{{#var:value}}
 +
|a+
 +
|A+={{#vardefine:displayRating|A+}}{{#vardefine:score|100}}
 +
|a
 +
|A={{#vardefine:displayRating|A}}{{#vardefine:score|100}}
 +
|a-
 +
|A-={{#vardefine:displayRating|A-}}{{#vardefine:score|91}}
 +
|b+
 +
|B+={{#vardefine:displayRating|B+}}{{#vardefine:score|83}}
 +
|b
 +
|B={{#vardefine:displayRating|B}}{{#vardefine:score|75}}
 +
|b-
 +
|B-={{#vardefine:displayRating|B-}}{{#vardefine:score|67}}
 +
|c+
 +
|C+={{#vardefine:displayRating|C+}}{{#vardefine:score|58}}
 +
|c
 +
|C={{#vardefine:displayRating|C}}{{#vardefine:score|50}}
 +
|c-
 +
|C-={{#vardefine:displayRating|C-}}{{#vardefine:score|42}}
 +
|d+
 +
|D+={{#vardefine:displayRating|D+}}{{#vardefine:score|33}}
 +
|d
 +
|D={{#vardefine:displayRating|D}}{{#vardefine:score|25}}
 +
|d-
 +
|D-={{#vardefine:displayRating|D-}}{{#vardefine:score|16}}
 +
|f+
 +
|F+={{#vardefine:displayRating|F+}}{{#vardefine:score|8}}
 +
|f
 +
|F={{#vardefine:displayRating|F}}{{#vardefine:score|0}}
 +
|f-
 +
|F-={{#vardefine:displayRating|F-}}{{#vardefine:score|0}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
}}
Line 91: Line 107:
 
|4||{{#var:displayRating}}||{{#var:score}}
 
|4||{{#var:displayRating}}||{{#var:score}}
 
|-
 
|-
 +
|}
 +
 +
===1-5s===
 +
{| class="prettytable" style="width:auto;"
 +
!Input
 +
!Display
 +
!Score
 +
|-
 +
{{ConvertRating|1-5s|1}}
 +
|1||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-5s|2.5}}
 +
|2.5||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-5s|3}}
 +
|3||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-5s|4.5}}
 +
|4.5||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-5s|5}}
 +
|5||{{#var:displayRating}}||{{#var:score}}
 +
|}
 +
 +
===1-10===
 +
{| class="prettytable" style="width:auto;"
 +
!Input
 +
!Display
 +
!Score
 +
|-
 +
{{ConvertRating|1-10|1}}
 +
|1||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-10|2.5}}
 +
|2.5||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-10|4}}
 +
|4||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-10|7.5}}
 +
|7.5||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|1-10|10}}
 +
|10||{{#var:displayRating}}||{{#var:score}}
 +
|}
 +
 +
===A-F===
 +
{| class="prettytable" style="width:auto;"
 +
!Input
 +
!Display
 +
!Score
 +
|-
 +
{{ConvertRating|A-F|A}}
 +
|A||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|A-F|B}}
 +
|B||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|A-F|C}}
 +
|C||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|A-F|D}}
 +
|D||{{#var:displayRating}}||{{#var:score}}
 +
|-
 +
{{ConvertRating|A-F|F}}
 +
|F||{{#var:displayRating}}||{{#var:score}}
 
|}
 
|}
  

Revision as of 06:07, 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

Input Display Score
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

1-5s

Input Display Score
1 1/51/51/51/51/5 0
2.5 2.5/52.5/52.5/52.5/52.5/5 37.5
3 3/53/53/53/53/5 50
4.5 4.5/54.5/54.5/54.5/54.5/5 87.5
5 5/55/55/55/55/5 100

1-10

Input Display Score
1 1/10 0
2.5 2.5/10 16.666666666667
4 4/10 33.333333333333
7.5 7.5/10 72.222222222222
10 10/10 100

A-F

Input Display Score
A A 100
B B 75
C C 50
D D 25
F F 0