Skip to content

Commit

Permalink
Bugfix: wrong key and wrong data for book project items
Browse files Browse the repository at this point in the history
  • Loading branch information
trevormunoz committed Jan 2, 2022
1 parent 0b10f7d commit 5ec57b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ function processRecord(
} = fields;

let chapter, page;
if (fields["lakeland_book_page (from book_info)"]) {
if (fields["lakeland_book_chapter (from book_info)"]) {
chapter = pluck(
fields["lakeland_book_page (from book_info)"] as string[],
fields["lakeland_book_chapter (from book_info)"] as string[],
);
}

Expand Down Expand Up @@ -216,7 +216,7 @@ function processRecord(
description,
type: item_type,
suppress_display: has_remove_reason ? true : false,
project: book ? { book } : undefined,
projects: book ? { book } : undefined,
asset: asset ? asset : undefined,
parent: part_of_object ? pluck(part_of_object as string[]) : undefined,
order: object_order ? object_order : 1,
Expand All @@ -225,6 +225,7 @@ function processRecord(
};

if (stubRecord) {
// filter out any keys that have values that are undefined
return Object.fromEntries(Object.entries(stubRecord).filter(([_, v]) => v));
} else {
console.warn(`No web item could be created from airtable record ${rec.id}`);
Expand Down

0 comments on commit 5ec57b7

Please sign in to comment.