RatingsTest
From Sega Retro
{{#vardefine:totalReviews|0}} {{#vardefine:cumulativeScore|0}} <!-- Calculate total number of reviews --> {{#if: {{{ace|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{ace}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{asm|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{asm}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{consolesplus|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{consolesplus}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{cvg|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{cvg}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{cvgit|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{cvgit}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{dcuk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{dcuk}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{dmuk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{dmuk}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{edge|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{edge}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{flux|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{flux}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{egm|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{egm}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gamesmachine|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gamesmachine}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gamesmachineuk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gamesmachineuk}}} }} }}{{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gamesmaster|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gamesmaster}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gameplayers|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gameplayers}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gamepower|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gamepower}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gamepro|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gamepro}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{generation|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{generation}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{gi|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{gi}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{happycomputer|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{happycomputer}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{highscore|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{highscore}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{hobbyconsolas|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{hobbyconsolas}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{joypad|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{joypad}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{joystick|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{joystick}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{maniac|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{maniac}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mdag|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mdag}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mega|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mega}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{megaforce|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{megaforce}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{megafun|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{megafun}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{megaplay|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{megaplay}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mm|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mm}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mms|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mms}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mrdc|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mrdc}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{mt|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{mt}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{odmfr|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{odmfr}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{odmuk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{odmuk}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{odmus|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{odmus}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{playerone|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{playerone}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{pp|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{pp}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{pu|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{pu}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{s|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{s}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{saturnplus|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{saturnplus}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{saturnpower|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{saturnpower}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{segamagjp|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{segamagjp}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{segamaguk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{segamaguk}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{segapower|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{segapower}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{segapro|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{segapro}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{sfuk|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{sfuk}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{sfsw|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{sfsw}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{smf|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{smf}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{smz|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{smz}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{ssm|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{ssm}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{supersonic|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{supersonic}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{sv|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{sv}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{tilt|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{tilt}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#if: {{{ts|}}} | {{#vardefine: cumulativeScore|{{#expr: {{#var: cumulativeScore}} + {{{ts}}} }} }} {{#vardefine: totalReviews|{{#expr: {{#var: totalReviews}} + 1 }} }} | }} {{#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)
- or not, but this still isn't optimal - we'd need to use prefixes for the score parameters - Andlabs 16:19, 2 March 2012 (CST)
- Not sure how you're doing things here, but you should be able to calculate totalReviews like so: {{#if {{{ug|}}} | 1 | 0 }}+{{#if {{{vgce|}}} | 1 | 0}}+etc. - Hivebrain 22:17, 2 March 2012 (CST)
- I'm trying to think of how to make it so we don't have to write that for every magazine - Andlabs 22:06, 4 March 2012 (CST)
- Okay, I think I'm done. It's a bit ugly but seems to do the job. Might need further testing. -Black Squirrel 06:18, 5 March 2012 (CST)
- I'm trying to think of how to make it so we don't have to write that for every magazine - Andlabs 22:06, 4 March 2012 (CST)
- Not sure how you're doing things here, but you should be able to calculate totalReviews like so: {{#if {{{ug|}}} | 1 | 0 }}+{{#if {{{vgce|}}} | 1 | 0}}+etc. - Hivebrain 22:17, 2 March 2012 (CST)