Apply suggestions from code review

Thanks for all the tweaks @advplyr!

Co-authored-by: advplyr <67830747+advplyr@users.noreply.github.com>
This commit is contained in:
Ben 2022-09-03 14:23:20 -04:00 committed by GitHub
parent f64c74519b
commit adba22cbd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 34 deletions

View file

@ -51,11 +51,8 @@ export default {
}
},
computed: {
coverAspectRatio() {
return this.$store.getters['getServerSetting']('coverAspectRatio')
},
bookCoverAspectRatio() {
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
return this.$store.getters['libraries/getBookCoverAspectRatio']
},
bookCoverWidth() {
return 70
@ -64,25 +61,6 @@ export default {
if (!this.listeningStats) return []
return this.listeningStats.sort(function(a, b) {return b.latest.lastUpdate - a.latest.lastUpdate})
},
userMediaProgress() {
return this.user.mediaProgress || []
},
userItemsFinished() {
if (!this.listeningStats) return []
return this.listeningStats.itemsRead
},
mostRecentListeningSessions() {
if (!this.listeningStats) return []
return this.listeningStats.recentSessions || []
},
totalMinutesListening() {
if (!this.listeningStats) return 0
return Math.round(this.listeningStats.totalTime / 60)
},
totalDaysListened() {
if (!this.listeningStats) return 0
return Object.values(this.listeningStats.days).length
},
usersOnline() {
var usermap = {}
this.$store.state.users.users.forEach((u) => (usermap[u.id] = { online: true, session: u.session }))
@ -109,14 +87,6 @@ export default {
}
this.listeningStats = listeningStats
},
async getLibraryItem(user) {
user.libraryItem = await this.$axios
.$get(`/api/items/${id}`)
.catch((error) => {
console.error('Failed', error)
return false
})
},
changeSharingSetting() {
this.$store.dispatch('user/updateUserSettings', { shareListeningActivity: !this.isSharingActivity })
this.init()