TechAndCheck / tech-and-check-alerts

Daily tip sheet for fact checkers
MIT License
13 stars 6 forks source link

Add dynamic newsletters #370

Closed slifty closed 4 years ago

slifty commented 4 years ago

Description

This PR changes the way our Newsletters are generated to be dynamic / database driven.

This removes the old "static" national and north carolina newsletters, and replaces their templates with a single template that takes in parameters to drive the differences between them.

NOTE: this PR is 90% there, but is lacking the due diligence checklist items.

Due Diligence Checklist

Steps to Test

  1. Update .env with the latest template values
  2. yarn migrate
  3. SQL: delete content from twitter_accounts
  4. SQL: delete content from twitter_account_lists
  5. sequelize db:seed --seed 20200531171618-default-newsletters
  6. yarn queue:jobs:run:twitter-account-list-scraper
  7. yarn queue:jobs:run:twitter-scrape-initiation
  8. yarn queue:jobs:run:cnn-portal-crawler
  9. yarn newsletter:send --national
  10. yarn test

Deploy Notes

Related Issues

Resolves #360

reefdog commented 4 years ago

Okay, a few more things I found after actually running the test steps:

  1. Testing instructions need to note the necessary .env additions
  2. Testing instructions should note the need to remove existing twitter accounts and twitter account lists before running the sync
  3. Testing instructions should note the need to fetch claims so the newsletter sendability requirements can be met
  4. Even after all that, running the newsletter test failed with Did not send the test newsletter. Error: You extended AbstractNewsletter but forgot to define getMailingListAddress(), which indeed seems to be the case, as DynamicNewsletterIssueGenerator hasn't renamed getMailingList to getMailingListAddress.
  5. Once I do that, I get this error: Did not send the test newsletter. Error: Unable to compile template. Error: ENOENT: no such file or directory, open '/Users/justin/Projects/duke/tech-and-check-alerts/src/server/workers/newsletterIssueGenerators/templates/dynamic.hbs'

At that point I'm tossing in the towel to boil some pasta, but I can check this out later!