Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
8cb745e5
Verified
Commit
8cb745e5
authored
Nov 03, 2018
by
Eliot Berriot
Browse files
Fix #599: wrong album/track count on artist page
parent
2739a5fb
Pipeline
#2330
passed with stages
in 7 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
changes/changelog.d/599.bugfix
0 → 100644
View file @
8cb745e5
Fixed wrong album/track count on artist page (#599)
front/src/components/library/Artist.vue
View file @
8cb745e5
...
...
@@ -94,6 +94,8 @@ export default {
isLoadingAlbums
:
true
,
artist
:
null
,
albums
:
null
,
totalTracks
:
0
,
totalAlbums
:
0
,
tracks
:
[]
}
},
...
...
@@ -107,12 +109,14 @@ export default {
logger
.
default
.
debug
(
'
Fetching artist "
'
+
this
.
id
+
'
"
'
)
axios
.
get
(
'
tracks/
'
,
{
params
:
{
artist
:
this
.
id
}}).
then
((
response
)
=>
{
self
.
tracks
=
response
.
data
.
results
self
.
totalTracks
=
response
.
data
.
count
})
axios
.
get
(
'
artists/
'
+
this
.
id
+
'
/
'
).
then
((
response
)
=>
{
self
.
artist
=
response
.
data
self
.
isLoading
=
false
self
.
isLoadingAlbums
=
true
axios
.
get
(
'
albums/
'
,
{
params
:
{
artist
:
self
.
id
,
ordering
:
'
-release_date
'
}}).
then
((
response
)
=>
{
self
.
totalAlbums
=
response
.
data
.
count
let
parsed
=
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
.
results
))
self
.
albums
=
parsed
.
map
((
album
)
=>
{
return
backend
.
Album
.
clean
(
album
)
...
...
@@ -129,22 +133,6 @@ export default {
title
:
this
.
$gettext
(
'
Artist
'
)
}
},
totalAlbums
()
{
let
trackAlbums
=
_
.
uniqBy
(
this
.
tracks
,
(
t
)
=>
{
return
t
.
album
.
id
})
return
this
.
albums
.
length
+
trackAlbums
.
length
},
totalTracks
()
{
if
(
this
.
albums
.
length
===
0
)
{
return
0
+
this
.
tracks
.
length
}
return
this
.
albums
.
map
((
album
)
=>
{
return
album
.
tracks
.
length
}).
reduce
((
a
,
b
)
=>
{
return
a
+
b
})
+
this
.
tracks
.
length
},
isPlayable
()
{
return
this
.
artist
.
albums
.
filter
((
a
)
=>
{
return
a
.
is_playable
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment