Basic feature implemented, very basic poc
This commit is contained in:
parent
216089a3e7
commit
48c0067076
118 changed files with 2113 additions and 20 deletions
5
app/models/check.rb
Normal file
5
app/models/check.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Check < ApplicationRecord
|
||||
enum :level, %i[A AA AAA]
|
||||
validates :position, :name, :success_criterion, :level, presence: true
|
||||
validates :position, numericality: { less_than: 200 }
|
||||
end
|
||||
6
app/models/checklist.rb
Normal file
6
app/models/checklist.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Checklist < ApplicationRecord
|
||||
has_many :checklist_entries, -> { order(position: :asc) }, dependent: :destroy, inverse_of: :checklist
|
||||
has_many :checks, through: :checklist_entries
|
||||
|
||||
accepts_nested_attributes_for :checklist_entries
|
||||
end
|
||||
4
app/models/checklist_entry.rb
Normal file
4
app/models/checklist_entry.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class ChecklistEntry < ApplicationRecord
|
||||
belongs_to :checklist
|
||||
belongs_to :check
|
||||
end
|
||||
6
app/models/element.rb
Normal file
6
app/models/element.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Element < ApplicationRecord
|
||||
attr_accessor :checklist_id
|
||||
|
||||
belongs_to :report
|
||||
has_many :success_criteria, dependent: :destroy
|
||||
end
|
||||
3
app/models/report.rb
Normal file
3
app/models/report.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class Report < ApplicationRecord
|
||||
has_many :elements, dependent: :destroy
|
||||
end
|
||||
4
app/models/success_criterion.rb
Normal file
4
app/models/success_criterion.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class SuccessCriterion < ApplicationRecord
|
||||
enum :result, %i[passed failed not_applicable]
|
||||
belongs_to :element
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue