Gui improvements, ordering
Some checks failed
/ Run tests (push) Failing after 1m9s
/ Run system tests (push) Failing after 1m13s
/ Build, push and deploy image (push) Has been skipped

This commit is contained in:
david 2024-11-01 03:26:46 +01:00
parent 6db0b64f4c
commit 42c077f6ab
28 changed files with 105 additions and 40 deletions

View file

@ -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