From 5cad998019df63473d4185eaa18246bbd3e64358 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 1 May 2025 14:50:41 +0100 Subject: [PATCH] only associate group on update if validation passes --- app/controllers/organisations_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 38c21d851..d4e4f34fc 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -128,9 +128,6 @@ class OrganisationsController < ApplicationController def update if (current_user.data_coordinator? && org_params[:active].nil?) || current_user.support? - if org_params[:group_member] && org_params[:group_member_id] - @organisation.group = assign_group_number(@organisation.id, org_params[:group_member_id]) - end if @organisation.update(org_params) case org_params[:active] when "false" @@ -146,6 +143,9 @@ class OrganisationsController < ApplicationController end flash[:notice] = I18n.t("organisation.reactivated", organisation: @organisation.name) else + if org_params[:group_member] && org_params[:group_member_id] + @organisation.group = assign_group_number(@organisation.id, org_params[:group_member_id]) + end flash[:notice] = I18n.t("organisation.updated") end if rent_period_params[:rent_periods].present?