-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use questions json and run cron #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@leo-step
leo-step
commented
Aug 2, 2022
- Read & display data directly from questions.json instead of overwriting src/data/index.js
- Run cron job every Sunday at 5pm PST to automatically update question metadata
Next up is checking companies and using "updated" field in questions.json as value for tooltip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @leo-step - you're on a roll!! 👏🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, 00:00
UTC is 8:00pm EDT
/5:00pm PDT
:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update here - I'm trying to remember why I had this conditional in the first place.. so weird 😅
Next up is checking companies and using "updated" field in questions.json as value for tooltip.
Makes sense to me! In order to grab the list of companies, we'll need to authenticate via the regular /login
API path, retrieve the session token, and pass that in the payload with the GraphQL queries. I might be wrong, but that's how I'm thinking we should tackle it - we can leverage other great repos like https://github.com/realvect0r/leetcode-api/blob/32b5658fd8e5c27ebddfe7f1198218e9e13be64e/src/lib/leetcode.ts#L35 if that's easier
Edit: I think there is where we'll need to add a username and password as secrets in GitHub so our Python script grab the username/password like SECRETS.USERNAME
and SECRETS.PASSWORD
. You can set them as env variables locally but be double check not to commit them when the time comes to open your PR!
USERNAME=leo PASSWORD=step python3 cron/update_questions.py
Edit 2: I've added LEETCODE_USERNAME
and LEETCODE_PASSWORD
as repository secrets that we can use in our GitHub Workflow later on!