Skip to content

Commit

Permalink
Merge pull request #235 from razeware/WEB-6625
Browse files Browse the repository at this point in the history
WEB-6625: Add free attribute to Lesson
  • Loading branch information
KapilSachdev authored Dec 28, 2023
2 parents 51bac32 + 0097f7a commit 4bc5c12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/lib/parser/lesson_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Parser
class LessonMetadata
include SimpleAttributes

VALID_SIMPLE_ATTRIBUTES = %i[title description_md learning_objectives_md ordinal ref].freeze
VALID_SIMPLE_ATTRIBUTES = %i[title description_md learning_objectives_md ordinal ref free].freeze

attr_accessor :lesson, :metadata

Expand Down
5 changes: 3 additions & 2 deletions app/models/lesson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ class Lesson
include Concerns::ImageAttachable
include Concerns::MarkdownRenderable

attr_accessor :title, :description_md, :ordinal, :ref, :segments, :learning_objectives_md
attr_accessor :title, :description_md, :ordinal, :ref, :segments, :learning_objectives_md, :free

attr_markdown :description, source: :description_md, file: false
attr_markdown :learning_objectives, source: :learning_objectives_md, file: false
validates :title, :ordinal, :ref, presence: true

def initialize(attributes = {})
super
@free ||= false
@segments ||= []
end

Expand All @@ -24,7 +25,7 @@ def slug

# Used for serialisation
def attributes
{ title: nil, description: nil, learning_objectives: nil, ordinal: nil, segments: [], ref: nil }.stringify_keys
{ title: nil, description: nil, learning_objectives: nil, ordinal: nil, segments: [], ref: nil, free: false }.stringify_keys
end

# Used for linting
Expand Down

0 comments on commit 4bc5c12

Please sign in to comment.