Skip to content

Commit

Permalink
Clarify accumulator reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
bryophyta committed May 25, 2023
1 parent b41eb64 commit 1d954ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/pressreader/src/processEdition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export function editionProcessor({ edition, capiConfig }: Props) {
return { run };

async function run() {
const USED_ARTICLE_IDS_STORE: string[] = [];

const sectionData = await Promise.all(
edition.sections.map(async (section) => {
const frontArticleIds = await getArticleIdsFromFronts(
Expand All @@ -60,7 +58,13 @@ export function editionProcessor({ edition, capiConfig }: Props) {
return { ...section, articleDetails };
}),
);
const USED_ARTICLE_IDS_STORE: string[] = [];
const OUTPUT_ACCUMULATOR: PressReaderEditionOutput = [];
/**
* Build up the list of articles for each section, checking that they
* pass meet the criteria for inclusion, and also making sure that we
* don't include the same article more than once in the edition.
*/
for (const section of sectionData) {
const articleIdsForSection = section.articleDetails
.filter((article) => {
Expand Down

0 comments on commit 1d954ea

Please sign in to comment.