repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/generic/collection_concern.rb | app/models/concerns/generic/collection_concern.rb | # frozen_string_literal: true
module Generic::CollectionConcern
extend ActiveSupport::Concern
included do
scope :paginated, lambda { |params|
page_number = params.fetch(:page_num, 1)
limit = params.fetch(:length.to_s, 25).to_f
offset = params.fetch(:start, (page_number.to_f - 1) * limit)
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/cikgo/pushable_item_concern.rb | app/models/concerns/cikgo/pushable_item_concern.rb | # frozen_string_literal: true
module Cikgo::PushableItemConcern
extend ActiveSupport::Concern
def pushable_lesson_plan_item_types
[Course::Assessment, Course::Video, Course::Survey]
end
def pushable?(something)
pushable_lesson_plan_item_types.include?(something.class)
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/duplication_concern.rb | app/models/concerns/course/duplication_concern.rb | # frozen_string_literal: true
module Course::DuplicationConcern
extend ActiveSupport::Concern
def initialize_duplicate(duplicator, other)
self.start_at = duplicator.time_shift(start_at)
self.end_at = duplicator.time_shift(end_at)
self.title = duplicator.options[:new_title]
self.creator = duplicator... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/levels_concern.rb | app/models/concerns/course/levels_concern.rb | # frozen_string_literal: true
module Course::LevelsConcern
extend ActiveSupport::Concern
# Returns the Course::Level object corresponding to the experience points provided.
# To use ruby to obtain the required level, ensure that course.levels is already loaded.
# Otherwise, an SQL call is fired for each method... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/material_concern.rb | app/models/concerns/course/material_concern.rb | # frozen_string_literal: true
module Course::MaterialConcern
extend ActiveSupport::Concern
include Course::Material::Folder::OrderingConcern
# Reloads the association.
def reload
remove_instance_variable(:@ordered_topologically) if defined?(@ordered_topologically)
super
end
# Retrieves the topolog... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/search_concern.rb | app/models/concerns/course/search_concern.rb | # frozen_string_literal: true
module Course::SearchConcern
extend ActiveSupport::Concern
module ClassMethods
# Search and filter courses by their titles, descriptions or user names.
# @param [String] keyword The keywords for filtering courses.
# @return [Array<Course>] The courses which match the keywo... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/forum_participation_concern.rb | app/models/concerns/course/forum_participation_concern.rb | # frozen_string_literal: true
module Course::ForumParticipationConcern
extend ActiveSupport::Concern
module ClassMethods
def forum_posts
joins(:topic).where('course_discussion_topics.actable_type = ?', Course::Forum::Topic.name)
end
def from_course(course)
joins(:topic).where('course_discu... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/sanitize_description_concern.rb | app/models/concerns/course/sanitize_description_concern.rb | # frozen_string_literal: true
#
# This concern helps sanitize items with description fields, in case a malicious user bypasses
# the sanitization provided by the WYSIWYG editor.
module Course::SanitizeDescriptionConcern
extend ActiveSupport::Concern
included do
before_save :sanitize_description
end
privat... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/closing_reminder_concern.rb | app/models/concerns/course/closing_reminder_concern.rb | # frozen_string_literal: true
#
# This concern provides common reminder methods for lesson_plan_items, specifically reminders:
# - When the lesson_plan_item is about to close
#
# When including this concern, the model is to implement the following for the reminders:
# - #{Model-Name}::ClosingReminderJob
#
# Note th... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/course_components_concern.rb | app/models/concerns/course/course_components_concern.rb | # frozen_string_literal: true
module Course::CourseComponentsConcern
extend ActiveSupport::Concern
include CourseComponentQueryConcern
def available_components
@available_components ||= begin
components = instance.enabled_components
gamified? ? components : components.reject(&:gamified?)
end
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/opening_reminder_concern.rb | app/models/concerns/course/opening_reminder_concern.rb | # frozen_string_literal: true
#
# This concern provides common reminder methods for lesson_plan_items, specifically reminders:
# - When the lesson_plan_item is open for students to attempt
#
# When including this concern, the model is to implement the following for the reminders:
# - #{Model-Name}::OpeningReminderJ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/lesson_plan/item_todo_concern.rb | app/models/concerns/course/lesson_plan/item_todo_concern.rb | # frozen_string_literal: true
module Course::LessonPlan::ItemTodoConcern
extend ActiveSupport::Concern
included do
after_create :create_todos, if: :has_todo?
around_update :handle_todos, if: :has_todo_changed?
end
def can_user_start?(user)
actable&.can_user_start?(user)
end
# Create todos for... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/lesson_plan/item/cikgo_push_concern.rb | app/models/concerns/course/lesson_plan/item/cikgo_push_concern.rb | # frozen_string_literal: true
module Course::LessonPlan::Item::CikgoPushConcern
extend ActiveSupport::Concern
include Rails.application.routes.url_helpers
include Cikgo::PushableItemConcern
included do
after_save :persist_dirty_states
# We use `after_commit`s for these because we want to only push aft... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/settings/lesson_plan_settings_concern.rb | app/models/concerns/course/settings/lesson_plan_settings_concern.rb | # frozen_string_literal: true
#
# This concern provides common defaults for querying and persisting lesson plan item settings
# for a course component. It abstracts out common code for components which only need their items
# fully enabled or disabled in the lesson plan.
#
# For more complicated settings, look at how a... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/discussion/topic/posts_concern.rb | app/models/concerns/course/discussion/topic/posts_concern.rb | # frozen_string_literal: true
module Course::Discussion::Topic::PostsConcern
extend ActiveSupport::Concern
include Course::Discussion::Post::OrderingConcern
# Reloads the association.
def reload
remove_instance_variable(:@ordered_topologically) if defined?(@ordered_topologically)
super
end
# Retri... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/discussion/post/ordering_concern.rb | app/models/concerns/course/discussion/post/ordering_concern.rb | # frozen_string_literal: true
module Course::Discussion::Post::OrderingConcern
extend ActiveSupport::Concern
# Sorts all posts in a collection in topological order.
#
# By convention, each post is represented by an array. The first element is the post itself,
# the second is the children of the array.
clas... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/discussion/post/retrieval_concern.rb | app/models/concerns/course/discussion/post/retrieval_concern.rb | # frozen_string_literal: true
module Course::Discussion::Post::RetrievalConcern
extend ActiveSupport::Concern
module ClassMethods
def posted_by(user)
where(creator: user)
end
def with_topic
includes(:topic)
end
def with_parent
includes(:parent)
end
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/todo_concern.rb | app/models/concerns/course/assessment/todo_concern.rb | # frozen_string_literal: true
module Course::Assessment::TodoConcern
extend ActiveSupport::Concern
def can_user_start?(user)
course_user = user.course_users.find_by(course: course)
conditions_satisfied_by?(course_user)
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/questions_concern.rb | app/models/concerns/course/assessment/questions_concern.rb | # frozen_string_literal: true
module Course::Assessment::QuestionsConcern
extend ActiveSupport::Concern
# Attempts the questions in the given submission without a current_answer.
#
# This will create answers for questions without any current_answer, and
# return them in the same order as specified.
#
# @... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/new_submission_concern.rb | app/models/concerns/course/assessment/new_submission_concern.rb | # frozen_string_literal: true
module Course::Assessment::NewSubmissionConcern
extend ActiveSupport::Concern
def create_new_submission(new_submission, current_user)
success = false
if randomization == 'prepared'
Course::Assessment::Submission.transaction do
qbas = question_bundle_assignments.w... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/submission/workflow_event_concern.rb | app/models/concerns/course/assessment/submission/workflow_event_concern.rb | # frozen_string_literal: true
module Course::Assessment::Submission::WorkflowEventConcern
extend ActiveSupport::Concern
include Course::LessonPlan::PersonalizationConcern
include Course::Assessment::Submission::CikgoTaskCompletionConcern
included do
before_validation :assign_experience_points, if: :workflo... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/submission/cikgo_task_completion_concern.rb | app/models/concerns/course/assessment/submission/cikgo_task_completion_concern.rb | # frozen_string_literal: true
module Course::Assessment::Submission::CikgoTaskCompletionConcern
WORKFLOW_STATE_TO_TASK_COMPLETION_STATUS = {
attempting: :ongoing,
submitted: :ongoing,
graded: :ongoing,
published: :completed
}.freeze
extend ActiveSupport::Concern
included do
after_save :pub... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/submission/todo_concern.rb | app/models/concerns/course/assessment/submission/todo_concern.rb | # frozen_string_literal: true
module Course::Assessment::Submission::TodoConcern
extend ActiveSupport::Concern
included do
after_save :update_todo, if: :saved_change_to_workflow_state?
after_destroy :restart_todo
end
def todo
@todo ||= begin
lesson_plan_item_id = assessment.lesson_plan_item.... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/submission/answers_concern.rb | app/models/concerns/course/assessment/submission/answers_concern.rb | # frozen_string_literal: true
module Course::Assessment::Submission::AnswersConcern
extend ActiveSupport::Concern
# Scope to obtain the latest answers for each question for Course::Assessment::Submission.
def latest_answers
unscope(:order).select('DISTINCT ON (question_id) *').order(:question_id, created_at:... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/assessment/submission/notification_concern.rb | app/models/concerns/course/assessment/submission/notification_concern.rb | # frozen_string_literal: true
module Course::Assessment::Submission::NotificationConcern
extend ActiveSupport::Concern
included do
after_save :send_submit_notification, if: :submitted?
after_create :send_attempt_notification
end
private
def send_attempt_notification
return unless course_user.re... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/material/folder/ordering_concern.rb | app/models/concerns/course/material/folder/ordering_concern.rb | # frozen_string_literal: true
module Course::Material::Folder::OrderingConcern
extend ActiveSupport::Concern
# Sorts all folders in a collection in topological order.
#
# By convention, each folder is represented by an array. The first element is the folder itself,
# the second is the children of the array.
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/survey/response/cikgo_task_completion_concern.rb | app/models/concerns/course/survey/response/cikgo_task_completion_concern.rb | # frozen_string_literal: true
module Course::Survey::Response::CikgoTaskCompletionConcern
extend ActiveSupport::Concern
included do
# TODO: Combine to `after_save` with `previously_new_record? || saved_change_to_submitted_at?`
# once up to Rails 6.1+. `previously_new_record?` is only available from Rails 6... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/survey/response/todo_concern.rb | app/models/concerns/course/survey/response/todo_concern.rb | # frozen_string_literal: true
module Course::Survey::Response::TodoConcern
extend ActiveSupport::Concern
included do
after_save :update_todo
after_destroy :restart_todo
end
def todo
@todo ||= begin
lesson_plan_item_id = survey.lesson_plan_item.id
Course::LessonPlan::Todo.find_by(item_i... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/interval_query_concern.rb | app/models/concerns/course/video/interval_query_concern.rb | # frozen_string_literal: true
module Course::Video::IntervalQueryConcern
extend ActiveSupport::Concern
module ClassMethods
def type_sym_to_id(symbols)
symbols.map { |sym| Course::Video::Event.event_types[sym] }
end
end
included do
start_types = [:play, :seek_end].freeze
end_types = [:pau... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/url_concern.rb | app/models/concerns/course/video/url_concern.rb | # frozen_string_literal: true
module Course::Video::UrlConcern
extend ActiveSupport::Concern
included do
before_validation :convert_to_embedded_url, if: :url_changed?
end
# Current format captures youtube's video_id for various urls.
YOUTUBE_FORMAT = [
/(?:https?:\/\/)?youtu\.be\/(.+)/,
/(?:http... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/watch_statistics_concern.rb | app/models/concerns/course/video/watch_statistics_concern.rb | # frozen_string_literal: true
module Course::Video::WatchStatisticsConcern
extend ActiveSupport::Concern
# Computes the watch frequency given the scope of events.
#
# Watch frequency is a list denoting the number of times a certain point in the video has been
# covered. In other words, each video time's freq... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/submission/todo_concern.rb | app/models/concerns/course/video/submission/todo_concern.rb | # frozen_string_literal: true
module Course::Video::Submission::TodoConcern
extend ActiveSupport::Concern
included do
after_create :complete_todo
after_destroy :restart_todo
end
def todo
@todo ||= begin
lesson_plan_item_id = video.lesson_plan_item.id
Course::LessonPlan::Todo.find_by(it... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/submission/notification_concern.rb | app/models/concerns/course/video/submission/notification_concern.rb | # frozen_string_literal: true
module Course::Video::Submission::NotificationConcern
extend ActiveSupport::Concern
included do
after_create :send_attempt_notification
end
private
def send_attempt_notification
return unless course_user.real_student?
Course::VideoNotifier.video_attempted(creator,... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course/video/submission/statistic/cikgo_task_completion_concern.rb | app/models/concerns/course/video/submission/statistic/cikgo_task_completion_concern.rb | # frozen_string_literal: true
module Course::Video::Submission::Statistic::CikgoTaskCompletionConcern
extend ActiveSupport::Concern
included do
after_save :publish_task_completion, if: :should_publish_task_completion?
end
private
COMPLETED_MINIMUM_WATCH_PERCENTAGE = 90
delegate :edit_course_video_su... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/instance/course_components_concern.rb | app/models/concerns/instance/course_components_concern.rb | # frozen_string_literal: true
module Instance::CourseComponentsConcern
extend ActiveSupport::Concern
include CourseComponentQueryConcern
def available_components
@available_components ||= Course::ControllerComponentHost.components
end
# All components can be disabled at the instance level.
# If there ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/duplication_traceable/assessment.rb | app/models/duplication_traceable/assessment.rb | # frozen_string_literal: true
class DuplicationTraceable::Assessment < ApplicationRecord
acts_as_duplication_traceable
validates :assessment, presence: true
belongs_to :assessment, class_name: 'Course::Assessment', inverse_of: :duplication_traceable
# Class that the duplication traceable depends on.
def sel... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/duplication_traceable/course.rb | app/models/duplication_traceable/course.rb | # frozen_string_literal: true
class DuplicationTraceable::Course < ApplicationRecord
acts_as_duplication_traceable
validates :course, presence: true
belongs_to :course, class_name: 'Course', inverse_of: :duplication_traceable
# Class that the duplication traceable depends on.
def self.dependent_class
'C... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/user/identity.rb | app/models/user/identity.rb | # frozen_string_literal: true
class User::Identity < ApplicationRecord
validates :provider, length: { maximum: 255 }, presence: true
validates :uid, length: { maximum: 255 }, presence: true
validates :user, presence: true
validates :provider, uniqueness: { scope: [:uid], if: -> { uid? && provider_changed? } }
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/user/email.rb | app/models/user/email.rb | # frozen_string_literal: true
# Represents an email address belonging to a user.
class User::Email < ApplicationRecord
before_validation(on: :create) do
remove_existing_unconfirmed_secondary_email
end
after_save :accept_all_pending_invitations
after_destroy :set_new_user_primary_email, if: :primary?
vali... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/learning_map.rb | app/models/course/learning_map.rb | # frozen_string_literal: true
class Course::LearningMap < ApplicationRecord
validates :course, presence: true
belongs_to :course, inverse_of: :learning_map
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/assessment.rb | app/models/course/assessment.rb | # frozen_string_literal: true
# Represents an assessment in Coursemology, as well as the enclosing module for associated models.
#
# An assessment is a collection of questions that can be asked.
class Course::Assessment < ApplicationRecord
acts_as_lesson_plan_item has_todo: true
acts_as_conditional
has_one_folder... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/story.rb | app/models/course/story.rb | # frozen_string_literal: true
class Course::Story
class << self
def for_course_user!(course_user)
return nil unless course_user.course.component_enabled?(Course::StoriesComponent)
Cikgo::TimelinesService.items!(course_user)&.map do |item|
new(item, course_user)
end
end
end
clas... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/group.rb | app/models/course/group.rb | # frozen_string_literal: true
class Course::Group < ApplicationRecord
validates :name, length: { maximum: 255 }, presence: true
validates :creator, presence: true
validates :updater, presence: true
validates :group_category, presence: true
validates :name, uniqueness: { scope: [:group_category_id], if: -> { g... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/enrol_request.rb | app/models/course/enrol_request.rb | # frozen_string_literal: true
class Course::EnrolRequest < ApplicationRecord
include Workflow
workflow do
state :pending do
event :approve, transitions_to: :approved
event :reject, transitions_to: :rejected
end
state :approved
state :rejected
end
validate :validate_user_not_in_cour... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/monitoring.rb | app/models/course/monitoring.rb | # frozen_string_literal: true
module Course::Monitoring
def self.table_name_prefix
'course_monitoring_'
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/forum.rb | app/models/course/forum.rb | # frozen_string_literal: true
class Course::Forum < ApplicationRecord
extend FriendlyId
friendly_id :slug_candidates, use: :scoped, scope: :course
validates :name, length: { maximum: 255 }, presence: true
validates :slug, length: { maximum: 255 }, allow_nil: true
validates :forum_topics_auto_subscribe, inclu... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/user_achievement.rb | app/models/course/user_achievement.rb | # frozen_string_literal: true
class Course::UserAchievement < ApplicationRecord
after_initialize :set_defaults, if: :new_record?
after_create :send_notification
validate :validate_course_user_in_course, on: :create
validates :obtained_at, presence: true
validates :course_user_id, uniqueness: { scope: [:achie... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/achievement.rb | app/models/course/achievement.rb | # frozen_string_literal: true
class Course::Achievement < ApplicationRecord
include Course::SanitizeDescriptionConcern
acts_as_conditional
mount_uploader :badge, ImageUploader
has_many_attachments on: :description
after_initialize :set_defaults, if: :new_record?
validates :title, length: { maximum: 255 }... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/rubric.rb | app/models/course/rubric.rb | # frozen_string_literal: true
class Course::Rubric < ApplicationRecord
include DuplicationStateTrackingConcern
validate :validate_no_reserved_category_names, unless: :duplicating?
validate :validate_unique_category_names
validate :validate_at_least_one_category
belongs_to :course, class_name: 'Course', inve... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/material.rb | app/models/course/material.rb | # frozen_string_literal: true
class Course::Material < ApplicationRecord
has_one_attachment
include DuplicationStateTrackingConcern
include Workflow
workflow do
state :not_chunked do
event :start_chunking, transitions_to: :chunking
end
# State where there is a job running to chunk course mate... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/experience_points_record.rb | app/models/course/experience_points_record.rb | # frozen_string_literal: true
class Course::ExperiencePointsRecord < ApplicationRecord
include Generic::CollectionConcern
actable optional: true
before_save :send_notification, if: :reached_new_level?
before_create :set_awarded_attributes, if: :manually_awarded?
validates :reason, presence: true, if: :manua... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/registration.rb | app/models/course/registration.rb | # frozen_string_literal: true
class Course::Registration
include ActiveModel::Model
extend ActiveModel::Naming
extend ActiveModel::Translation
include ActiveModel::Conversion
# @!attribute [rw] course
# The course the registration is for.
# @return [Course]
attr_accessor :course
# @!attribute [r... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/discussion.rb | app/models/course/discussion.rb | # frozen_string_literal: true
module Course::Discussion
def self.table_name_prefix
'course_discussion_'
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/user_invitation.rb | app/models/course/user_invitation.rb | # frozen_string_literal: true
class Course::UserInvitation < ApplicationRecord
after_initialize :generate_invitation_key, if: :new_record?
after_initialize :set_defaults, if: :new_record?
before_validation :set_defaults, if: :new_record?
validates :email, format: { with: Devise.email_regexp }, if: :email_chang... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/group_user.rb | app/models/course/group_user.rb | # frozen_string_literal: true
class Course::GroupUser < ApplicationRecord
after_initialize :set_defaults, if: :new_record?
enum :role, { normal: 0, manager: 1 }
validate :course_user_and_group_in_same_course
validates :role, presence: true
validates :creator, presence: true
validates :updater, presence: t... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings.rb | app/models/course/settings.rb | # frozen_string_literal: true
class Course::Settings; end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/question_assessment.rb | app/models/course/question_assessment.rb | # frozen_string_literal: true
class Course::QuestionAssessment < ApplicationRecord
before_validation :set_defaults, if: :new_record?
validates :weight, numericality: { only_integer: true }, presence: true
validates :assessment, presence: true
validates :question, presence: true
validates :assessment_id, uniq... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/scholaistic_assessment.rb | app/models/course/scholaistic_assessment.rb | # frozen_string_literal: true
class Course::ScholaisticAssessment < ApplicationRecord
acts_as_lesson_plan_item
validates :upstream_id, presence: true, uniqueness: { scope: :course_id }
validate :no_bonus_exp_attributes
has_many :scholaistic_assessment_conditions,
class_name: Course::Condition::Scho... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan.rb | app/models/course/lesson_plan.rb | # frozen_string_literal: true
module Course::LessonPlan
def self.table_name_prefix
"#{Course.table_name.singularize}_lesson_plan_"
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/video.rb | app/models/course/video.rb | # frozen_string_literal: true
class Course::Video < ApplicationRecord
after_save :init_statistic
acts_as_conditional
acts_as_lesson_plan_item has_todo: true
include Course::ClosingReminderConcern
include Course::Video::UrlConcern
include Course::Video::WatchStatisticsConcern
include DuplicationStateTrac... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/user_email_unsubscription.rb | app/models/course/user_email_unsubscription.rb | # frozen_string_literal: true
class Course::UserEmailUnsubscription < ApplicationRecord
validates :course_user, presence: true
belongs_to :course_user, inverse_of: :email_unsubscriptions
belongs_to :course_setting_email, class_name: 'Course::Settings::Email',
foreign_key: :cou... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/reference_time.rb | app/models/course/reference_time.rb | # frozen_string_literal: true
class Course::ReferenceTime < ApplicationRecord
include DuplicationStateTrackingConcern
belongs_to :reference_timeline, class_name: 'Course::ReferenceTimeline', inverse_of: :reference_times
belongs_to :lesson_plan_item, class_name: 'Course::LessonPlan::Item', inverse_of: :reference_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/level.rb | app/models/course/level.rb | # frozen_string_literal: true
class Course::Level < ApplicationRecord
include Course::ModelComponentHost::Component
validates :experience_points_threshold, numericality: { greater_than_or_equal_to: 0, less_than: 2_147_483_648 },
presence: true
validates :course, presence:... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/scholaistic_submission.rb | app/models/course/scholaistic_submission.rb | # frozen_string_literal: true
class Course::ScholaisticSubmission < ApplicationRecord
acts_as_experience_points_record
validates :upstream_id, presence: true
validates :assessment, presence: true
validates :creator, presence: true
belongs_to :assessment, inverse_of: :submissions, class_name: Course::Scholai... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/survey.rb | app/models/course/survey.rb | # frozen_string_literal: true
class Course::Survey < ApplicationRecord
acts_as_conditional
acts_as_lesson_plan_item has_todo: true
include Course::ClosingReminderConcern
validates :end_at, presence: true, if: :allow_response_after_end
validates :anonymous, inclusion: { in: [true, false] }
validates :allow... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/reference_timeline.rb | app/models/course/reference_timeline.rb | # frozen_string_literal: true
class Course::ReferenceTimeline < ApplicationRecord
belongs_to :course, inverse_of: :reference_timelines
has_many :reference_times,
class_name: 'Course::ReferenceTime', inverse_of: :reference_timeline, dependent: :destroy
has_many :course_users, foreign_key: :reference_tim... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/notification.rb | app/models/course/notification.rb | # frozen_string_literal: true
# The course level notification. This is meant to be called by the Notifications Framework
#
# @api notifications
class Course::Notification < ApplicationRecord
enum :notification_type, { feed: 0, email: 1 }
validates :activity, presence: true
validates :course, presence: true
be... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/personal_time.rb | app/models/course/personal_time.rb | # frozen_string_literal: true
class Course::PersonalTime < ApplicationRecord
belongs_to :course_user, inverse_of: :personal_times
belongs_to :lesson_plan_item, class_name: 'Course::LessonPlan::Item', inverse_of: :personal_times
validates :start_at, presence: true
validates :course_user, presence: true, uniquen... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/group_category.rb | app/models/course/group_category.rb | # frozen_string_literal: true
class Course::GroupCategory < ApplicationRecord
validates :name, length: { maximum: 255 }, presence: true
validates :creator, presence: true
validates :updater, presence: true
validates :course, presence: true
validates :name, uniqueness: { scope: [:course_id], if: -> { course_id... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/learning_rate_record.rb | app/models/course/learning_rate_record.rb | # frozen_string_literal: true
class Course::LearningRateRecord < ApplicationRecord
validates :learning_rate, presence: true, numericality: { greater_than_or_equal_to: 0 }
# It is possible for effective limits to go negative, so we won't check for that
validates :effective_min, presence: true, numericality: true
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/announcement.rb | app/models/course/announcement.rb | # frozen_string_literal: true
class Course::Announcement < ApplicationRecord
include AnnouncementConcern
include Course::OpeningReminderConcern
acts_as_readable on: :updated_at
has_many_attachments on: :content
before_save :sanitize_text
validates :title, length: { maximum: 255 }, presence: true
valida... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/condition.rb | app/models/course/condition.rb | # frozen_string_literal: true
class Course::Condition < ApplicationRecord
actable
validates :actable_type, length: { maximum: 255 }, allow_nil: true
validates :conditional_type, length: { maximum: 255 }, presence: true
validates :creator, presence: true
validates :updater, presence: true
validates :course,... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan/event.rb | app/models/course/lesson_plan/event.rb | # frozen_string_literal: true
class Course::LessonPlan::Event < ApplicationRecord
acts_as_lesson_plan_item
validates :location, length: { maximum: 255 }, allow_nil: true
validates :event_type, length: { maximum: 255 }, presence: true
def initialize_duplicate(duplicator, other)
self.course = duplicator.opt... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan/item.rb | app/models/course/lesson_plan/item.rb | # frozen_string_literal: true
class Course::LessonPlan::Item < ApplicationRecord
include Course::LessonPlan::ItemTodoConcern
include Course::SanitizeDescriptionConcern
include Course::LessonPlan::Item::CikgoPushConcern
has_many :personal_times,
foreign_key: :lesson_plan_item_id, class_name: 'Course:... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan/event_material.rb | app/models/course/lesson_plan/event_material.rb | # frozen_string_literal: true
class Course::LessonPlan::EventMaterial < ApplicationRecord
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan/todo.rb | app/models/course/lesson_plan/todo.rb | # frozen_string_literal: true
class Course::LessonPlan::Todo < ApplicationRecord
include Workflow
workflow do
state :not_started
state :in_progress
state :completed
end
after_initialize :set_default_values, if: :new_record?
validates :workflow_state, length: { maximum: 255 }, presence: true
v... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/lesson_plan/milestone.rb | app/models/course/lesson_plan/milestone.rb | # frozen_string_literal: true
class Course::LessonPlan::Milestone < ApplicationRecord
acts_as_lesson_plan_item has_todo: false
def initialize_duplicate(duplicator, other)
self.course = duplicator.options[:destination_course]
copy_attributes(other, duplicator)
end
# Used by the with_actable_types scope... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/scholaistic_component.rb | app/models/course/settings/scholaistic_component.rb | # frozen_string_literal: true
class Course::Settings::ScholaisticComponent < Course::Settings::Component
include ActiveModel::Conversion
def assessments_title
settings.assessments_title
end
def assessments_title=(assessments_title)
settings.assessments_title = assessments_title.presence
end
def i... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/component.rb | app/models/course/settings/component.rb | # frozen_string_literal: true
#
# This serves as a base class for course settings models that are associated with
# a course component.
#
class Course::Settings::Component < SimpleDelegator
include ActiveModel::Validations
# Update settings with the hash attributes
#
# @param [Hash] attributes The hash for the... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/survey_component.rb | app/models/course/settings/survey_component.rb | # frozen_string_literal: true
class Course::Settings::SurveyComponent < Course::Settings::Component
include Course::Settings::LessonPlanSettingsConcern
def lesson_plan_item_settings
super
end
def showable_in_lesson_plan?
settings.lesson_plan_items ? settings.lesson_plan_items['enabled'] : true
end
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/lesson_plan_component.rb | app/models/course/settings/lesson_plan_component.rb | # frozen_string_literal: true
class Course::Settings::LessonPlanComponent < Course::Settings::Component
include ActiveModel::Conversion
MILESTONES_EXPANDED_VALUES = %w[all none current].freeze
# Returns the setting which controls which milestones groups are expanded when
# the lesson plan page is first loaded... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/topics_component.rb | app/models/course/settings/topics_component.rb | # frozen_string_literal: true
class Course::Settings::TopicsComponent < Course::Settings::Component
include ActiveModel::Conversion
validates :pagination, numericality: { greater_than: 0, less_than_or_equal_to: 50 }
def title
settings.title
end
def title=(title)
title = nil if title.blank?
sett... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/videos_component.rb | app/models/course/settings/videos_component.rb | # frozen_string_literal: true
class Course::Settings::VideosComponent < Course::Settings::Component
include ActiveModel::Conversion
include Course::Settings::LessonPlanSettingsConcern
def self.component_class
Course::VideosComponent
end
def lesson_plan_item_settings
super.merge(component_title: titl... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/sidebar_item.rb | app/models/course/settings/sidebar_item.rb | # frozen_string_literal: true
class Course::Settings::SidebarItem
include ActiveModel::Model
include ActiveModel::Validations
validates :weight, numericality: { greater_than: 0 }
# @param [#settings] settings The scoped settings object.
# @param [Hash] sidebar_item The hash which contains the attributes of ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/forums_component.rb | app/models/course/settings/forums_component.rb | # frozen_string_literal: true
class Course::Settings::ForumsComponent < Course::Settings::Component
include ActiveModel::Conversion
validates :pagination, numericality: { greater_than: 0 }
FORUM_POST_MARK_ANSWER_USER_VALUES = %w[creator_only everyone].freeze
def self.component_class
Course::ForumsCompone... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/components.rb | app/models/course/settings/components.rb | # frozen_string_literal: true
class Course::Settings::Components < Settings
include ComponentSettingsConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/email.rb | app/models/course/settings/email.rb | # frozen_string_literal: true
class Course::Settings::Email < ApplicationRecord
self.table_name = 'course_settings_emails'
Course.after_initialize do
Course::Settings::Email.send(:after_course_initialize, self)
end
Course::Assessment::Category.after_initialize do
Course::Settings::Email.send(:after_as... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/materials_component.rb | app/models/course/settings/materials_component.rb | # frozen_string_literal: true
class Course::Settings::MaterialsComponent < Course::Settings::Component
include ActiveModel::Conversion
# Returns the title of materials component
#
# @return [String] The custom or default title of announcements component
def title
settings.title
end
# Sets the title ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/lesson_plan_items.rb | app/models/course/settings/lesson_plan_items.rb | # frozen_string_literal: true
#
# This model facilitates displaying and setting of lesson plan item settings.
#
# To add lesson plan item settings to a course component, ensure that these two methods
# are defined on the component's setting model
# (see {Course::ControllerComponentHost::Settings::ClassMethods#settings_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/rag_wise_component.rb | app/models/course/settings/rag_wise_component.rb | # frozen_string_literal: true
class Course::Settings::RagWiseComponent < Course::Settings::Component
include ActiveModel::Conversion
def self.component_class
Course::RagWiseComponent
end
def response_workflow
settings.response_workflow || '0'
end
def response_workflow=(response_workflow)
sett... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/leaderboard_component.rb | app/models/course/settings/leaderboard_component.rb | # frozen_string_literal: true
class Course::Settings::LeaderboardComponent < Course::Settings::Component
include ActiveModel::Conversion
validates :display_user_count, numericality: { greater_than_or_equal_to: 0 }
# Returns the title of leaderboard component
#
# @return [String] The custom or default title ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/stories_component.rb | app/models/course/settings/stories_component.rb | # frozen_string_literal: true
class Course::Settings::StoriesComponent < Course::Settings::Component
include ActiveModel::Conversion
def push_key
settings.push_key
end
def push_key=(push_key)
push_key = push_key.presence
settings.push_key = push_key
end
def title
settings.title
end
d... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/assessments_component.rb | app/models/course/settings/assessments_component.rb | # frozen_string_literal: true
class Course::Settings::AssessmentsComponent < Course::Settings::Component
class << self
# Do not add this to a destroy callback in the Tab model as it will get invoked when
# the course is being destroyed and saving of the course here to save the settings
# will cause the co... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/learning_map_component.rb | app/models/course/settings/learning_map_component.rb | # frozen_string_literal: true
class Course::Settings::LearningMapComponent < Course::Settings::Component
def self.component_class
Course::LearningMapComponent
end
def title
settings.title
end
def title=(title)
title = nil if title.blank?
settings.title = title
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/users_component.rb | app/models/course/settings/users_component.rb | # frozen_string_literal: true
class Course::Settings::UsersComponent < Course::Settings::Component
def self.component_class
Course::UsersComponent
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/sidebar.rb | app/models/course/settings/sidebar.rb | # frozen_string_literal: true
class Course::Settings::Sidebar
include ActiveModel::Model
include ActiveModel::Conversion
attr_reader :sidebar_items
# @param [#settings] course_settings The settings object provided by the settings_on_rails gem.
# @param [Array<Hash>] sidebar_items The sidebar items.
def in... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/codaveri_component.rb | app/models/course/settings/codaveri_component.rb | # frozen_string_literal: true
class Course::Settings::CodaveriComponentValidator < ActiveModel::Validator
def self.all_feedback_workflows
['none', 'draft', 'publish'].freeze
end
def self.all_models
[
'gpt-4o',
'gpt-4o-mini',
'gpt-o1',
'gpt-o3',
'gpt-o3-mini',
'gpt-5',
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/pan_component.rb | app/models/course/settings/pan_component.rb | # frozen_string_literal: true
#
# This serves as a base class for course settings models that are need settings
# from more than 1 course component.
#
class Course::Settings::PanComponent < SimpleDelegator
include ActiveModel::Validations
def initialize(components)
@components = components
super
end
#... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/settings/announcements_component.rb | app/models/course/settings/announcements_component.rb | # frozen_string_literal: true
class Course::Settings::AnnouncementsComponent < Course::Settings::Component
include ActiveModel::Conversion
def self.component_class
Course::AnnouncementsComponent
end
# Returns the title of announcements component
#
# @return [String] The custom or default title of anno... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course/rubric/mock_answer_evaluation.rb | app/models/course/rubric/mock_answer_evaluation.rb | # frozen_string_literal: true
class Course::Rubric::MockAnswerEvaluation < ApplicationRecord
validates :mock_answer, presence: true
validates :rubric, presence: true
belongs_to :mock_answer, class_name: 'Course::Assessment::Question::MockAnswer', inverse_of: :rubric_evaluations
belongs_to :rubric, class_name: ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.