Fixed phantom domain statuses

This commit is contained in:
Sergei Tsoganov 2022-11-10 17:17:57 +02:00
parent 1961b87f95
commit fc99ada943
2 changed files with 45 additions and 22 deletions

View file

@ -58,10 +58,11 @@ module Serializers
}
end
def statuses
statuses_with_notes = domain.status_notes
def statuses(statuses_with_notes = {})
status_notes = domain.status_notes
domain.statuses.each do |status|
statuses_with_notes.merge!({ "#{status}": '' }) unless statuses_with_notes.key?(status)
status_note = status_notes[status.to_s].presence || ''
statuses_with_notes.merge!({ "#{status}": status_note })
end
statuses_with_notes
end