This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatGame(game) { | |
return { | |
id: game.id, | |
name: game.name, | |
openCriticScore: (game.topCriticScore > 0) ? Math.round(game.topCriticScore) : null, | |
reviewCount: game.numReviews, | |
percentRecommended: (game.percentRecommended > 0) ? Math.round(game.percentRecommended) : null, | |
openCriticUrl: buildUrl('game', game.id, game.name), | |
award: game.tier ? game.tier : '' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"mastheadScreenshot": { | |
"fullRes": "//c.opencritic.com/images/games/7407/aibDuCdJiBsP5V7kEx.jpg", | |
"thumbnail": "//c.opencritic.com/images/games/7407/aibDuCdJiBsP5V7kEx_th.jpg" | |
}, | |
"bannerScreenshot": { | |
"fullRes": "//c.opencritic.com/images/games/7407/banner.jpg" | |
}, | |
"Rating": { | |
"value": "T", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatScore (score, ScoreFormat, showDecimals) { | |
let ret = ''; | |
if (ScoreFormat.isNumeric) { | |
// Convert the 0 - 100 score to the 0 - X score of the score format. | |
ret = '' + (score / ScoreFormat.base); | |
// If we're showing deicmals | |
// AND there's a decimal place in this Score format | |
// AND the remainder is 0 |