Skip to content

Conversation

leo-step
Copy link
Contributor

  • Store question data in json format
  • Cron job script reads and updates questions json
  • Sets "updated" field to current datetime
  • Commits the changes back into the repository
Copy link
Owner

@seanprashad seanprashad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're on a roll @leo-step! Thank you once again for helping implement this - I know it'll definitely be appreciated by others for sure.

Everything is looking good - I think we should handle the case where questions.json isn't able to be opened/read.


for question in questions["data"]:
p = urlparse(question["url"])
title_slug = p.path.rstrip('/').split('/')[-1]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it probably makes more sense to just have the slug for url since each URL is prefixed with https://leetcode.com/problems/

for question in questions:
print("Reading questions file")

with open("questions.json", "r") as file:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to have an except clause incase questions.json can't be opened/found


their_difficulty = response.json()["data"]["question"]["difficulty"]

if their_difficulty != our_difficulty:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if their_difficulty != our_difficulty:
if leetcode_difficulty != our_difficulty:

Could we make this small change here and in other relevant places? I think it'll help make reading the code a little easier!

@leo-step leo-step requested a review from seanprashad August 1, 2022 18:21
@seanprashad seanprashad merged commit c1e33db into seanprashad:master Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants