Difference between revisions of "RatingsTest"

From Sega Retro

(Created page with "<pre>{{#vardefine:totalReviews|0}} {{#vardefine:cumulativeScore|0}} <!-- Calculate total number of reviews --> {{#if: {{{ug|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#va...")
 
Line 14: Line 14:
 
}}
 
}}
 
}}</pre>
 
}}</pre>
this will be hell - [[User:Andlabs|Andlabs]] 16:15, 2 March 2012 (CST)
+
this will be hell<br>
 +
ideally we would be able to iterate over all the magazine name parameters, but I highly doubt mediawiki is that smart - [[User:Andlabs|Andlabs]] 16:15, 2 March 2012 (CST)

Revision as of 17:17, 2 March 2012

{{#vardefine:totalReviews|0}}
{{#vardefine:cumulativeScore|0}}
<!-- Calculate total number of reviews -->
{{#if: {{{ug|}}} 	| {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{ug}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }}
{{#if: {{{vgce|}}} 	| {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{vgce}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }}


<!-- in case it can't cope with divide by zero -->
{{#ifeq: {{#var: totalReviews}} | 0 | {{#vardefine: totalReviews|1}} | }}

<!-- Calculate average -->
{{#vardefine: average|
	{{#expr: {{#var: cumulativeScore}} / {{#var: totalReviews}}
	}}
}}

this will be hell
ideally we would be able to iterate over all the magazine name parameters, but I highly doubt mediawiki is that smart - Andlabs 16:15, 2 March 2012 (CST)