edit comment and pdf export
This commit is contained in:
parent
110d75f2b7
commit
c36230b8ba
10 changed files with 90 additions and 19 deletions
|
|
@ -3,7 +3,20 @@
|
|||
class Report < ApplicationRecord
|
||||
has_many :pages, -> { order(:position) }, dependent: :destroy
|
||||
has_many :elements, through: :pages, dependent: :destroy
|
||||
has_many :success_criteria, through: :elements, dependent: :destroy
|
||||
|
||||
has_rich_text :comment
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
def export
|
||||
export_success_criteria = success_criteria.failed
|
||||
export_elements = export_success_criteria.group_by(&:element)
|
||||
export_pages = export_elements.group_by { |k, v| k }
|
||||
{
|
||||
pages: export_pages,
|
||||
elements: export_elements,
|
||||
success_criteria: export_success_criteria
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue