diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/client.html | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/web/client.html b/web/client.html index 51ddf3b..bc49369 100644 --- a/web/client.html +++ b/web/client.html @@ -112,8 +112,8 @@ } function appendSongDetails(song, details) { - let possibleDetails = ['upvotes', 'downvotes', 'album', 'year']; - for (const detail of possibleDetails) { + let possibleSimpleDetails = ['album', 'year']; + for (const detail of possibleSimpleDetails) { if (Object.hasOwn(song, detail)) { let value = song[detail]; if (!value) { @@ -123,6 +123,17 @@ details.appendChild(document.createTextNode(label + ': ' + value + ' ')); } } + + if (Object.hasOwn(song, 'upvotes') && Object.hasOwn(song, 'downvotes')) { + let uvs = Object.keys(song['upvotes']).length + details.appendChild(document.createTextNode('Upvotes: ' + uvs + ' ')); + + let dvs = Object.keys(song['downvotes']).length + details.appendChild(document.createTextNode('Downvotes: ' + dvs + ' ')); + + let timeBonus = song.weight - uvs + dvs + details.appendChild(document.createTextNode('TimeBonus: ' + timeBonus.toFixed(1) + ' ')); + } } function newSong(song) { |
