-
Notifications
You must be signed in to change notification settings - Fork 519
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
Clean up topics vs practices in config.json #1421
Clean up topics vs practices in config.json #1421
Conversation
b08d96b
to
66785c4
Compare
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.
Thank you, this is useful work! While I'd slightly prefer it if the script were written in Rust, I do understand the desire for a shorter script for a utility item like this, and it will be fine that it's currently in Python.
I do love Rust; it just seemed a bit overkill for this use-case. And thank you for the suggestions! 😃 |
@coriolinus Is this an important issue? If so, how would you like it to be resolved? Is this logic I should add to the script? |
Not sure, I haven't seen it before. I asked the other maintainers. I'll let you know when I hear back. |
The response seems to be that:
To me this sounds like we need a post-processing step. I think it's safe to assume that entries in for concept in concepts:
count = 0
for practice_exercise in config['exercises']['practice']:
if concept in practice_exercise['practices']:
count += 1
if count > 10:
practice_exercise['practices'].remove(concept) |
Thanks for looking into that. I've worked that logic into the script and re-ran it. |
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.
Just two more edits, sorry.
- If we remove a topic from the
practices
array due to count, we should put it back into thetopics
array. That ensures we don't destroy information. I should have thought of that earlier. - Both the
practices
andtopics
arrays should be sorted for each exercise after all other modifications are complete. The linter will complain otherwise.
Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
c2e06ff
to
40f5dbd
Compare
Sounds good, added that logic as well |
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 doing this work!
Glad I could help! 😃 |
Addresses #1407. I think this also has something to do with #1089. Though I'm not entirely sure.
I also created a python script to automate this task.