Skip to content

Commit

Permalink
Fix mailchimp-members passing wrong object values
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAdamDavis committed Oct 26, 2023
1 parent 4bf0c37 commit a97abac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion packages/mg-mailchimp-members/src/lib/member-stats.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {process} from './process.js';

const memberStats = async ({csvPath, zipPath, includeUnsubscribed = false}: {csvPath?: string | string[], zipPath?: string, includeUnsubscribed?: boolean}) => {
type memberStatsOptions = {
csvPath?: string | string[];
zipPath?: string;
includeUnsubscribed?: boolean;
}

const memberStats = async ({csvPath, zipPath, includeUnsubscribed = false}: memberStatsOptions) => {
let allMembers: number = 0;

if (csvPath) {
Expand Down
3 changes: 1 addition & 2 deletions packages/mg-mailchimp-members/src/lib/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type memberObject = {

type processDataOptions = {
pathToCsv?: string;
pathToZip?: string;
csvContent?: string;
addLabel?: string | null;
includeUnsubscribed: boolean;
Expand All @@ -26,7 +25,7 @@ type processOptions = {
includeUnsubscribed?: boolean
}

const processData = async ({pathToCsv, pathToZip, csvContent, addLabel, includeUnsubscribed = false}: processDataOptions) => {
const processData = async ({pathToCsv, csvContent, addLabel, includeUnsubscribed = false}: processDataOptions) => {
const csvData = (csvContent) ? await fsUtils.csv.parseString(csvContent) : await fsUtils.csv.parseCSV(pathToCsv);

let theMembers: memberObject[] = [];
Expand Down
3 changes: 2 additions & 1 deletion packages/migrate/sources/mailchimp-members.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getTaskRunner = (options, logger) => {
ctx.logger = logger;

// 0. Prep a file cache for the work we are about to do.
ctx.options.cacheName = options.cacheName || fsUtils.utils.cacheNameFromPath(options.pathToCsv[0]);
ctx.options.cacheName = options.cacheName || fsUtils.utils.cacheNameFromPath(options.pathToZip || options.pathToCsv[0]);
ctx.fileCache = new fsUtils.FileCache(`mailchimp-members-${ctx.options.cacheName}`, {
tmpPath: ctx.options.tmpPath,
contentDir: false
Expand All @@ -30,6 +30,7 @@ const getTaskRunner = (options, logger) => {
try {
ctx.result = await csvIngest({
pathToCsv: options.pathToCsv,
pathToZip: options.pathToZip,
addLabel: options.addLabel,
includeUnsubscribed: options.includeUnsubscribed
});
Expand Down

0 comments on commit a97abac

Please sign in to comment.