Cosmetics
Some checks failed
/ Run tests (push) Successful in 1m52s
/ Run system tests (push) Failing after 2m3s
/ Build, push and deploy image (push) Successful in 1m45s

This commit is contained in:
david 2024-11-11 05:00:51 +01:00
parent ee5dbcf33e
commit e569bcb246
21 changed files with 54 additions and 65 deletions

View file

@ -4,7 +4,7 @@ class Element < ApplicationRecord
has_rich_text :description
belongs_to :page, touch: true
has_many :success_criteria, dependent: :destroy
has_many :success_criteria, -> { order(:position) }, dependent: :destroy
delegate :report, to: :page

View file

@ -7,6 +7,11 @@ class Page < ApplicationRecord
before_validation :set_position
before_update :update_positions, if: :position_changed?
def full_url
return nil if report.url.blank? && url.blank?
[ "https:/", report.url&.sub(/.*:\/\//, ""), url&.sub(/^\//, "") ].compact_blank.join("/")
end
private
def set_position