Skip to content

Commit

Permalink
credits: usernames are unique and merged
Browse files Browse the repository at this point in the history
Fixes #1549
  • Loading branch information
sogehige committed Nov 12, 2018
1 parent 774191d commit 68dcd98
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/overlay/components/credits.vue
Expand Up @@ -108,23 +108,24 @@ export default {
withoutPadding = false
}
for (let o of object) {
let html = o.username
const groupByUsername = Object.entries(_.groupBy(object, 'username'))
for (let [username, o] of groupByUsername) {
let html = username
if (key === 'cheer') {
html = `<strong style="font-size:65%">${o.bits} bits</strong> <br> ${o.username}`
html = `<strong style="font-size:65%">${o.reduce((a, b) => ({ bits: Number(a.bits) + Number(b.bits) })).bits} bits</strong> <br> ${username}`
} else if (['raid', 'host'].includes(key)) {
html = `<strong style="font-size:65%">${o.viewers} viewers</strong> <br> ${o.username}`
html = `<strong style="font-size:65%">${o.reduce((a, b) => ({ viewers: Number(a.viewers) + Number(b.viewers) })).viewers} viewers</strong> <br> ${username}`
} else if (['resub'].includes(key)) {
html = `<strong style="font-size:65%">${o.months} months</strong> <br> ${o.username}`
html = `<strong style="font-size:65%">${o[0].months} months</strong> <br> ${username}`
} else if (['tip'].includes(key)) {
html = `<strong style="font-size:65%">${Number(o.amount).toFixed(2)} ${o.currency}</strong> <br> ${o.username}`
html = `<strong style="font-size:65%">${Number(o.reduce((a, b) => ({ amount: Number(a.amount) + Number(b.amount) })).amount).toFixed(2)} ${o[0].currency}</strong> <br> ${username}`
}
page.push({
text: html,
class: "text4 column"
})
}
for (let i = 0; i < 3 - (object.length % 3); i++) {
for (let i = 0; i < 3 - (groupByUsername.length % 3); i++) {
page.push({
text: '',
class: "text4 column"
Expand Down

0 comments on commit 68dcd98

Please sign in to comment.