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
Store unversioned scripts in other directory #42084
Conversation
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.
This change looks good! Should definitely preserve consistency, but I have one nit about the implementation. I'd rather see this logic laid out in a way that makes the most sense given the new logic, rather than in a way that most easily fits into the existing layout.
I'm thinking something like
# in script model
def unversioned?
version_year.blank? || version_year == 'unversioned'
end
script_i18n_directory =
if ScriptConstants.unit_in_category?(:hoc, script.name)
File.join(level_content_directory, "Hour of Code")
elsif script.unversioned?
File.join(level_content_directory, "other")
else
File.join(level_content_directory, script.version_year)
end
@Hamms I agree that's a better solution long term. Made the update in the latest commit. |
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.
One final nit, then LGTM!
dashboard/app/models/script.rb
Outdated
@@ -1812,6 +1812,10 @@ def course_title | |||
unit_group.try(:localized_title) | |||
end | |||
|
|||
def unversioned? | |||
version_year.blank? || version_year == 'unversioned' |
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.
I poked around a bit more, and it looks like we actually have a constant for this!
version_year.blank? || version_year == 'unversioned' | |
version_year.blank? || version_year == CourseVersion::UNVERSIONED |
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.
Ah thanks for finding this!
What: The directory that scripts with a
version_year
ofunversioned
are saved in - won't be the same as versioned scripts.Why: Unversioned scripts were being skipped with the existing logic
Links
Testing story
Ran
sync-in.rb
locally and no scripts were skippedBefore:
After:
PR Checklist: