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
Add is_stable to course #28275
Add is_stable to course #28275
Changes from 7 commits
7837c71
a9d7e39
c614331
ff6071d
ec89b09
273350d
95ad1be
b7c5fd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ def skip_name_format_validation | |
has_verified_resources | ||
family_name | ||
version_year | ||
is_stable | ||
) | ||
|
||
def to_param | ||
|
@@ -55,6 +56,14 @@ def localized_version_title | |
I18n.t("data.course.name.#{name}.version_title", default: version_year) | ||
end | ||
|
||
# Any course with a plc_course or no family_name is considered stable. | ||
# All other courses must specify an is_stable boolean property. | ||
def stable_or_default | ||
return true if plc_course || !family_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we consider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great question. so far from what i understand, we've been going on that assumption, but @davidsbailey might have more insight here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. depending on family_name seems fine for now. currently, the presence of family_name implies the presence of version year in the |
||
|
||
is_stable || false | ||
end | ||
|
||
def self.file_path(name) | ||
Rails.root.join("config/courses/#{name}.course") | ||
end | ||
|
@@ -188,8 +197,7 @@ def assignable_info(user = nil) | |
info[:assignment_family_title] = localized_assignment_family_title | ||
info[:version_year] = version_year || ScriptConstants::DEFAULT_VERSION_YEAR | ||
info[:version_title] = localized_version_title | ||
# For now, all course versions visible in the UI are stable. | ||
info[:is_stable] = true | ||
info[:is_stable] = stable_or_default | ||
info[:category] = I18n.t('courses_category') | ||
info[:script_ids] = user ? | ||
scripts_for_user(user).map(&:id) : | ||
|
@@ -296,9 +304,7 @@ def summarize_versions(user = nil) | |
version_year: c.version_year, | ||
version_title: c.localized_version_title, | ||
can_view_version: c.can_view_version?(user), | ||
# TODO: (madelynkasula) Update is_stable to no longer be hard-coded once | ||
# properties[:is_stable] is implemented for courses. | ||
is_stable: true | ||
is_stable: stable_or_default | ||
} | ||
end | ||
|
||
|
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.
Looks like a comment of mine disappeared -- this name seems confusing because it is redundant, because "default" means "latest stable". Can we call it
stable?
instead?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.
yeah, good call! i'll update the naming now