-
Notifications
You must be signed in to change notification settings - Fork 3
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
improve link logging #1235
improve link logging #1235
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1235 +/- ##
==========================================
- Coverage 90.74% 90.68% -0.06%
==========================================
Files 212 212
Lines 8839 8850 +11
Branches 1634 1635 +1
==========================================
+ Hits 8021 8026 +5
- Misses 709 715 +6
Partials 109 109
Continue to review full report at Codecov.
|
73b6dd8
to
1d6d604
Compare
1d6d604
to
11280af
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.
Overall looks great, just one suggestion
def get_ocw_url(content: WebsiteContent): | ||
"""Return an ocw.mit.edu url to the given content.""" | ||
rootrel = get_rootrelative_url_from_content(content) | ||
return f"https://ocw.mit.edu{rootrel}" | ||
|
||
|
||
def get_studio_url(content: WebsiteContent): | ||
"""Return an ocw-studio.odl.mit.edu url to the given content.""" | ||
site_name = content.website.name | ||
if content.type == "sitemetadata": | ||
return f"https://ocw-studio.odl.mit.edu/sites/{site_name}/type/metadata/" | ||
return f"https://ocw-studio.odl.mit.edu/sites/{site_name}/type/page/edit/{content.text_id}/" | ||
|
||
|
||
def get_github_url(content: WebsiteContent): | ||
"""Return a github.mit.edu url to the given content.""" | ||
short_id = content.website.short_id | ||
return f"https://github.mit.edu/mitocwcontent/{short_id}/tree/main/{content.dirpath}/{content.filename}.md" | ||
|
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.
Might be better to use django settings for the domains instead of hardcoding them. For example:
OCW_STUDIO_BASE_URL
for the OCW Studio domain
GIT_DOMAIN
for the github domain
OCW_STUDIO_LIVE_URL
for ocwnext, though this isn't ocw.mit.edu
on production (it's https://ocw-published.odl.mit.edu/
instead - maybe that should be changed?) but should lead to the same place.
Pre-Flight checklist
What are the relevant tickets?
None
What's this PR do?
Miscellaneous improvements to the output of
markdown_cleanup
and link logging rule that I made when opening #1233:--limit
option for the management command, useful for testingHow should this be manually tested?
Run
and check that the links in the CSV work.