diff --git a/client/src/helpers/functions.js b/client/src/helpers/functions.js
index cb29759..6b50ec6 100644
--- a/client/src/helpers/functions.js
+++ b/client/src/helpers/functions.js
@@ -24,10 +24,22 @@ export function timeDifference(previous) {
}
}
+/**
+ * Convert seconds to a readable string
+ * @param {Number} seconds
+ */
+export function secToTime(seconds) {
+ const min = Math.floor(seconds / 60)
+ let newSec = Math.floor(seconds - min * 60)
+ newSec = newSec < 10 ? '0' + newSec : newSec
+
+ return `${min}:${newSec}`
+}
+
/**
* Sort an array of players by role
*/
-export function sortTeamByRole (a, b) {
+export function sortTeamByRole(a, b) {
const sortingArr = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
return sortingArr.indexOf(a.role) - sortingArr.indexOf(b.role)
}
diff --git a/client/src/helpers/summoner.js b/client/src/helpers/summoner.js
index c7e5b79..38c95dd 100644
--- a/client/src/helpers/summoner.js
+++ b/client/src/helpers/summoner.js
@@ -1,4 +1,4 @@
-import { timeDifference } from '@/helpers/functions.js'
+import { secToTime, timeDifference } from '@/helpers/functions.js'
import { maps, gameModes } from '@/data/data.js'
import summonerSpells from '@/data/summonerSpells.json'
@@ -63,16 +63,19 @@ export function createBasicSummonerData(RiotData) {
* @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.maxTime.time = secToTime(records.maxTime.time)
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}%`
+ // New record fields
+ if (records.maxLiving) {
+ records.maxLiving.longestLiving = secToTime(records.maxLiving.longestLiving)
+ records.maxHeal.heal = records.maxHeal.heal.toLocaleString()
+ }
+
return records
}
diff --git a/client/src/views/SummonerRecords.vue b/client/src/views/SummonerRecords.vue
index 8219a07..b3324a5 100644
--- a/client/src/views/SummonerRecords.vue
+++ b/client/src/views/SummonerRecords.vue
@@ -101,6 +101,15 @@
:record="records.maxDmgTaken"
title="Damage taken"
/>
+