Skip to content

Conversation

@cfinck27
Copy link

Potential fix for #153

Since these are all old strips that aren't being updated, they are never more recent than expirationDate, which means only the first strip is kept:

.filter((strip, i) => (i === 0 || new Date(strip.date) > expirationDate)) // keeps recent strips

To mitigate this I added a minimumCount variable that applies globally, but this could also be moved to a per-scraper value.

Not sure what the other options are since these aren't being updated, but if there's still a desire to see some in the feed then this is probably the best compromise.


const verifiedSeriesObjects = objMapValue(newSeriesObjects, newSeriesObject => {
const strips = newSeriesObject.strips
.map(({ url, date, imageUrl }) => ({ url, date, imageUrl }))
.filter((strip, i) => (i === 0 || new Date(strip.date) > expirationDate)) // keeps recent strips
.slice(0, expirationCount)
return strips ? { ...newSeriesObject, strips } : null
})

@ArtskydJ
Copy link
Owner

Thanks for the PR!

I think the root cause of #153 is something else. IIRC gocomics messed with URLs and I wasn't handling them right? Maybe still am not?

I don't recall why I forced it to keep at least one comic strip, so I don't know whether or not I want to bump that number up.

@cfinck27
Copy link
Author

Sure thing, wasn't sure if that was the desired behavior anyways.
FWIW I did test it and it saved off 10 entries instead of 1 after running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants