diff --git a/seeds/06_affiliates.js b/seeds/06_affiliates.js index 2a523606..987012b1 100755 --- a/seeds/06_affiliates.js +++ b/seeds/06_affiliates.js @@ -1070,16 +1070,19 @@ exports.seed = async (knex) => { const affiliate = affiliates.find((aff) => aff.id === affiliateId) || affiliates.find((aff) => aff.channel === resolvedChannel) - || affiliates.find((aff) => aff.network === resolvedNetwork); + || affiliates.find((aff) => aff.network === resolvedNetwork) + || affiliates.find((aff) => aff.channel === resolvedNetwork); // independent channel if (!affiliate) { console.warn('UNMATCHED AFFILIATE', file); } + const isIndependent = affiliate?.channel && affiliate.channel === resolvedNetwork; + return { file, - network: resolvedNetwork, - channel: resolvedChannel, + network: isIndependent ? null : resolvedNetwork, + channel: isIndependent ? resolvedNetwork : resolvedChannel, affiliateId, affiliate: getAffiliateId(affiliate), banner,