Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generated updated questions json and commit #205

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

Merged
seanprashad merged 7 commits into seanprashad:master from leo-step:generate-questions
Aug 1, 2022

Conversation

Copy link
Contributor

@leo-step leo-step commented Jul 31, 2022

  • 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

seanprashad reacted with rocket emoji
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.


print("Updating question metadata")

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

@seanprashad seanprashad Jul 31, 2022

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/

leo-step reacted with thumbs up emoji
for question in questions:
print("Reading questions file")

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

@seanprashad seanprashad Jul 31, 2022

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

leo-step reacted with thumbs up emoji
@@ -23,5 +31,12 @@

if their_difficulty != our_difficulty:
Copy link
Owner

@seanprashad seanprashad Jul 31, 2022

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 reacted with thumbs up emoji
@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
Reviewers

@seanprashad seanprashad seanprashad approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /