Skip to content

Commit

Permalink
Fix NULL error with weight field in assemblies & processes (#7491)
Browse files Browse the repository at this point in the history
Co-authored-by: LauraJaimeC <75725233+LauraJaimeC@users.noreply.github.com>
  • Loading branch information
mrcasals and laurajaime committed Mar 2, 2021
1 parent e4c21f7 commit 7aae7de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AssemblyForm < Form
attribute :parent_id, Integer
attribute :participatory_processes_ids, Array[Integer]
attribute :scope_id, Integer
attribute :weight, Integer
attribute :weight, Integer, default: 0

attribute :is_transparent, Boolean
attribute :promoted, Boolean
Expand Down Expand Up @@ -80,6 +80,8 @@ class AssemblyForm < Form
validates :banner_image, passthru: { to: Decidim::Assembly }
validates :hero_image, passthru: { to: Decidim::Assembly }

validates :weight, presence: true

alias organization current_organization

def ensure_parent_cannot_be_child
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ParticipatoryProcessForm < Form
attribute :scope_id, Integer
attribute :related_process_ids, Array[Integer]
attribute :scope_type_max_depth_id, Integer
attribute :weight, Integer
attribute :weight, Integer, default: 0

attribute :private_space, Boolean
attribute :promoted, Boolean
Expand All @@ -59,6 +59,8 @@ class ParticipatoryProcessForm < Form
validates :banner_image, passthru: { to: Decidim::ParticipatoryProcess }
validates :hero_image, passthru: { to: Decidim::ParticipatoryProcess }

validates :weight, presence: true

alias organization current_organization

def map_model(model)
Expand Down

0 comments on commit 7aae7de

Please sign in to comment.