Skip to content
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

Merged
merged 3 commits into from Aug 18, 2021

Conversation

smusoke
Copy link
Contributor

@smusoke smusoke commented Aug 17, 2021

What: The directory that scripts with a version_year of unversioned 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 skipped

Before:
Screen Shot 2021-08-18 at 12 56 51 PM

After:
Screen Shot 2021-08-18 at 1 43 51 PM

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@smusoke smusoke requested a review from a team as a code owner August 17, 2021 21:57
Copy link
Contributor

@Hamms Hamms left a 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

@smusoke
Copy link
Contributor Author

smusoke commented Aug 18, 2021

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.

Copy link
Contributor

@Hamms Hamms left a 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!

@@ -1812,6 +1812,10 @@ def course_title
unit_group.try(:localized_title)
end

def unversioned?
version_year.blank? || version_year == 'unversioned'
Copy link
Contributor

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!

Suggested change
version_year.blank? || version_year == 'unversioned'
version_year.blank? || version_year == CourseVersion::UNVERSIONED

Copy link
Contributor Author

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!

@smusoke smusoke merged commit 79701e0 into staging Aug 18, 2021
@smusoke smusoke deleted the fnd-1666-fix-sync-in-script-skip branch August 18, 2021 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants