Difference between revisions of "ConvertRating/Single"

From Sega Retro

Line 93: Line 93:
 
|5-={{#vardefine:displayRating|5-}}{{#vardefine:score|{{#expr:(1/15) * 100}}}}
 
|5-={{#vardefine:displayRating|5-}}{{#vardefine:score|{{#expr:(1/15) * 100}}}}
 
|6={{#vardefine:displayRating|6}}{{#vardefine:score|0}}
 
|6={{#vardefine:displayRating|6}}{{#vardefine:score|0}}
 +
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 +
 +
|1-6+={{#switch:{{#var:value}}
 +
|6+={{#vardefine:displayRating|6+}}{{#vardefine:score|100}}
 +
|6={{#vardefine:displayRating|6}}{{#vardefine:score|{{#expr:(14/15) * 100}}}}
 +
|6--={{#vardefine:displayRating|6-}}{{#vardefine:score|{{#expr:(13/15) * 100}}}}
 +
|5+={{#vardefine:displayRating|5+}}{{#vardefine:score|80}}
 +
|5={{#vardefine:displayRating|5}}{{#vardefine:score|{{#expr:(11/15) * 100}}}}
 +
|5-={{#vardefine:displayRating|5-}}{{#vardefine:score|{{#expr:(10/15) * 100}}}}
 +
|4+={{#vardefine:displayRating|4+}}{{#vardefine:score|60}}
 +
|4={{#vardefine:displayRating|4}}{{#vardefine:score|{{#expr:(8/15) * 100}}}}
 +
|4-={{#vardefine:displayRating|4-}}{{#vardefine:score|{{#expr:(7/15) * 100}}}}
 +
|3+={{#vardefine:displayRating|3+}}{{#vardefine:score|40}}
 +
|3={{#vardefine:displayRating|3}}{{#vardefine:score|{{#expr:(5/15) * 100}}}}
 +
|3-={{#vardefine:displayRating|3-}}{{#vardefine:score|{{#expr:(4/15) * 100}}}}
 +
|2+={{#vardefine:displayRating|2+}}{{#vardefine:score|20}}
 +
|2={{#vardefine:displayRating|2}}{{#vardefine:score|{{#expr:(2/15) * 100}}}}
 +
|2-={{#vardefine:displayRating|2-}}{{#vardefine:score|{{#expr:(1/15) * 100}}}}
 +
|1={{#vardefine:displayRating|1}}{{#vardefine:score|0}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
|#default={{#vardefine:displayRating|Unknown value!}}{{#vardefine:score|}}
 
}}
 
}}

Revision as of 10:31, 1 April 2021

Rating conversion code for when there's only one value - stops Mediawiki from complaining about recursion.