Skip to content

Commit

Permalink
Extract a seam and attempt naming to improve clarity #3234
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed May 10, 2024
1 parent 05ffab7 commit 179a02d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ type Ports = {
fetchData: FetchData,
};

const calculateEarliestPublicationDateToConsider = (earliestPublicationDateToConsider: Date | undefined): Date => (
earliestPublicationDateToConsider instanceof Date
? earliestPublicationDateToConsider
: daysAgo(5)
);

export const discoverEvaluationsFromHypothesisGroup = (
publisherGroupId: string,
earliestPublicationDateToConsider?: Date,
avoidWhenPublishedBefore?: Date,
): DiscoverPublishedEvaluations => (ports: Ports) => pipe(
publisherGroupId,
Hyp.fetchEvaluationsByGroupSince(
earliestPublicationDateToConsider instanceof Date ? earliestPublicationDateToConsider : daysAgo(5),
calculateEarliestPublicationDateToConsider(avoidWhenPublishedBefore),
ports.fetchData,
),
TE.map(RA.map(convertHypothesisAnnotationToEvaluation(tagToEvaluationTypeMap))),
Expand Down

0 comments on commit 179a02d

Please sign in to comment.