Gui improvements, ordering
This commit is contained in:
parent
6db0b64f4c
commit
42c077f6ab
28 changed files with 105 additions and 40 deletions
|
|
@ -8,6 +8,8 @@ class Element < ApplicationRecord
|
|||
|
||||
delegate :report, to: :page
|
||||
|
||||
after_validation :set_position
|
||||
|
||||
# Calculate actual conformity level:
|
||||
# - if a success_criterion has result :failed -> the confirmity_level
|
||||
# of that success_criterion is not reached.
|
||||
|
|
@ -30,4 +32,9 @@ class Element < ApplicationRecord
|
|||
def max_level
|
||||
@max_level ||= success_criteria.reject(&:not_applicable?).max(&:level)
|
||||
end
|
||||
|
||||
def set_position
|
||||
Rails.logger.debug("element: position #{position}")
|
||||
self.position ||= (page.elements.pluck(:position).max || 0) + 1
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue