Fixed: Size on disk sorting and display

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/1807/head
Qstick 4 years ago
parent 3a1abfa9f1
commit adc47c51e0

@ -416,7 +416,7 @@ class AlbumDetails extends Component {
<span className={styles.sizeOnDisk}> <span className={styles.sizeOnDisk}>
{ {
formatBytes(statistics.sizeOnDisk) formatBytes(statistics.sizeOnDisk || 0)
} }
</span> </span>
</Label> </Label>

@ -460,7 +460,7 @@ class ArtistDetails extends Component {
<span className={styles.sizeOnDisk}> <span className={styles.sizeOnDisk}>
{ {
formatBytes(sizeOnDisk) formatBytes(sizeOnDisk || 0)
} }
</span> </span>
</Label> </Label>

@ -114,7 +114,9 @@ export const filterPredicates = {
sizeOnDisk: function(item, filterValue, type) { sizeOnDisk: function(item, filterValue, type) {
const predicate = filterTypePredicates[type]; const predicate = filterTypePredicates[type];
const sizeOnDisk = item.statistics ? item.statistics.sizeOnDisk : 0; const sizeOnDisk = item.statistics && item.statistics.sizeOnDisk ?
item.statistics.sizeOnDisk :
0;
return predicate(sizeOnDisk, filterValue); return predicate(sizeOnDisk, filterValue);
} }
@ -133,6 +135,12 @@ export const sortPredicates = {
} }
return result; return result;
},
sizeOnDisk: function(item) {
const { statistics = {} } = item;
return statistics.sizeOnDisk || 0;
} }
}; };

@ -207,12 +207,6 @@ export const defaultState = {
return statistics.totalTrackCount || 0; return statistics.totalTrackCount || 0;
}, },
sizeOnDisk: function(item) {
const { statistics = {} } = item;
return statistics.sizeOnDisk;
},
ratings: function(item) { ratings: function(item) {
const { ratings = {} } = item; const { ratings = {} } = item;

Loading…
Cancel
Save