Change the way trackId and albumId are set.

This commit is contained in:
Renato "Lond" Cerqueira 2016-12-17 14:13:25 +01:00 committed by Jonathan Cremin
parent eac6ce7269
commit 00b24efdc5

View file

@ -60,8 +60,8 @@ export function findMatchesAsync(share) {
console.log(match)
if (match.id) {
models.match.create({
trackId: share.albumName ? share.id : null,
albumId: share.albumName ? null : share.id,
trackId: share.$modelOptions.name.singular == 'track' ? share.id : null,
albumId: share.$modelOptions.name.singular == 'album' ? share.id : null,
externalId: match.id,
service: match.service,
name: match.name,
@ -72,8 +72,8 @@ export function findMatchesAsync(share) {
});
} else {
models.match.create({
trackId: share.trackId ? share.id : null,
albumId: share.albumId ? share.id : null,
trackId: share.$modelOptions.name.singular == 'track' ? share.id : null,
albumId: share.$modelOptions.name.singular == 'album' ? share.id : null,
externalId: null,
service: match.service,
name: null,