Skip to content

Commit

Permalink
rename to fromPrint
Browse files Browse the repository at this point in the history
  • Loading branch information
AWare committed Oct 22, 2019
1 parent be047c7 commit 13c3f63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions projects/archiver/src/tasks/image/helpers/media.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test('getImage', () => {
showQuotedHeadline: false,
mediaType: 'Image',
elements: [],
fromPrint: true,
}
expect(getImagesFromArticle(article)).toContain(image)
})
2 changes: 1 addition & 1 deletion projects/backend/__tests__/helpers/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Content = <T extends string>(
showQuotedHeadline,
mediaType,
sportScore,
print: false,
fromPrint: false,
})

const Article = ({
Expand Down
16 changes: 8 additions & 8 deletions projects/backend/capi/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const getMainMediaAtom = (

const parseArticleResult = async (
result: IContent,
print: boolean,
fromPrint: boolean,
): Promise<[number, CAPIContent]> => {
const path = result.id
console.log(`Parsing CAPI response for ${path}`)
Expand Down Expand Up @@ -149,7 +149,7 @@ const parseArticleResult = async (
elements,
starRating,
mainMedia: getMainMediaAtom(result.blocks),
print,
fromPrint,
},
]
return article
Expand All @@ -169,7 +169,7 @@ const parseArticleResult = async (
bylineHtml: bylineHtml || '',
standfirst: trail || '',
elements,
print,
fromPrint,
},
]

Expand All @@ -190,7 +190,7 @@ const parseArticleResult = async (
bylineHtml: bylineHtml || '',
standfirst: trail || '',
elements,
print,
fromPrint,
},
]

Expand Down Expand Up @@ -232,7 +232,7 @@ const parseArticleResult = async (
bylineHtml: bylineHtml || '',
standfirst: trail || '',
crossword,
print,
fromPrint,
},
]

Expand Down Expand Up @@ -263,7 +263,7 @@ const parseArticleResult = async (
html: `<pre>${JSON.stringify(result.apiUrl)}</pre>`,
},
],
print,
fromPrint,
},
]
}
Expand All @@ -286,7 +286,7 @@ export const getArticles = async (
capi: 'printsent' | 'search',
): Promise<{ [key: string]: CAPIContent }> => {
const paths = ids.map(_ => `internal-code/page/${_}`)
const print = capi === 'printsent'
const fromPrint = capi === 'printsent'
const endpoint = capi === 'printsent' ? printsent(paths) : search(paths)
if (endpoint.length > 1000) {
console.warn(
Expand Down Expand Up @@ -322,7 +322,7 @@ export const getArticles = async (
const data = SearchResponseCodec.decode(input)
const results: IContent[] = data.results
const articlePromises = await Promise.all(
results.map(result => attempt(parseArticleResult(result, print))),
results.map(result => attempt(parseArticleResult(result, fromPrint))),
)

//If we fail to get an article in a collection we just ignore it and move on.
Expand Down
2 changes: 1 addition & 1 deletion projects/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export interface Content extends WithKey {
showQuotedHeadline: boolean
mediaType: MediaType
sportScore?: string
print: boolean
fromPrint: boolean
}
export interface Article extends Content {
type: 'article'
Expand Down

0 comments on commit 13c3f63

Please sign in to comment.