mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-04 04:59:37 +01:00
Merge pull request #1144 from austinphilp/fix-listening-sessions-count-bug
Fix listening sessions count bug
This commit is contained in:
commit
b260bcaeb1
@ -24,7 +24,7 @@
|
|||||||
<div class="py-2">
|
<div class="py-2">
|
||||||
<h1 class="text-lg mb-2 text-white text-opacity-90 px-2 sm:px-0">{{ $strings.HeaderListeningStats }}</h1>
|
<h1 class="text-lg mb-2 text-white text-opacity-90 px-2 sm:px-0">{{ $strings.HeaderListeningStats }}</h1>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<p class="text-sm text-gray-300">{{ listeningSessions.length }} {{ $strings.HeaderListeningSessions }}</p>
|
<p class="text-sm text-gray-300">{{ listeningSessions.total }} {{ $strings.HeaderListeningSessions }}</p>
|
||||||
<ui-btn :to="`/config/users/${user.id}/sessions`" class="text-xs mx-2" :padding-x="1.5" :padding-y="1">{{ $strings.ButtonViewAll }}</ui-btn>
|
<ui-btn :to="`/config/users/${user.id}/sessions`" class="text-xs mx-2" :padding-x="1.5" :padding-y="1">{{ $strings.ButtonViewAll }}</ui-btn>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-sm text-gray-300">
|
<p class="text-sm text-gray-300">
|
||||||
@ -110,7 +110,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
listeningSessions: [],
|
listeningSessions: {},
|
||||||
listeningStats: {},
|
listeningStats: {},
|
||||||
purgingMediaProgress: false
|
purgingMediaProgress: false
|
||||||
}
|
}
|
||||||
@ -147,8 +147,8 @@ export default {
|
|||||||
return this.listeningStats.today || 0
|
return this.listeningStats.today || 0
|
||||||
},
|
},
|
||||||
latestSession() {
|
latestSession() {
|
||||||
if (!this.listeningSessions.length) return null
|
if (!this.listeningSessions.sessions || !this.listeningSessions.sessions.length) return null
|
||||||
return this.listeningSessions[0]
|
return this.listeningSessions.sessions[0]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -159,11 +159,11 @@ export default {
|
|||||||
this.listeningSessions = await this.$axios
|
this.listeningSessions = await this.$axios
|
||||||
.$get(`/api/users/${this.user.id}/listening-sessions?page=0&itemsPerPage=10`)
|
.$get(`/api/users/${this.user.id}/listening-sessions?page=0&itemsPerPage=10`)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data.sessions || []
|
return data || {}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('Failed to load listening sesions', err)
|
console.error('Failed to load listening sesions', err)
|
||||||
return []
|
return {}
|
||||||
})
|
})
|
||||||
this.listeningStats = await this.$axios.$get(`/api/users/${this.user.id}/listening-stats`).catch((err) => {
|
this.listeningStats = await this.$axios.$get(`/api/users/${this.user.id}/listening-stats`).catch((err) => {
|
||||||
console.error('Failed to load listening sesions', err)
|
console.error('Failed to load listening sesions', err)
|
||||||
@ -221,4 +221,4 @@ export default {
|
|||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user