fix: forgot to push helper method for creating records

This commit is contained in:
Valentin Kaelin 2020-01-12 01:35:36 +01:00
parent 5ab71a0292
commit 305818be23

View file

@ -58,6 +58,24 @@ export function createBasicSummonerData(RiotData) {
return RiotData return RiotData
} }
/**
* Return the formatted records of a summoner
* @param {Object} records : raw records from the database stats
*/
export function createRecordsData(records) {
const min = Math.floor(records.maxTime.time / 60)
let newSec = Math.floor(records.maxTime.time - min * 60)
newSec = newSec < 10 ? '0' + newSec : newSec
records.maxTime.time = `${min}:${newSec}`
records.maxGold.gold = records.maxGold.gold.toLocaleString()
records.maxDmgTaken.dmgTaken = records.maxDmgTaken.dmgTaken.toLocaleString()
records.maxDmgChamp.dmgChamp = records.maxDmgChamp.dmgChamp.toLocaleString()
records.maxDmgObj.dmgObj = records.maxDmgObj.dmgObj.toLocaleString()
records.maxKp.kp = `${records.maxKp.kp}%`
return records
}
function getLeagueData(leagueData, leagueName) { function getLeagueData(leagueData, leagueName) {
if (!leagueData) return null if (!leagueData) return null