workaround for departments creating with users allready assigned

parent 063d01f2
Pipeline #77088 passed with stage
in 9 minutes and 35 seconds
......@@ -20,7 +20,12 @@ class DepartmentsController < ApplicationController
def create
@department = Department.new
authorize @department
if @department.update(permitted_attributes(@department))
@department.assign_attributes(permitted_attributes(@department).except(:user_ids))
if @department.save
if permitted_attributes(@department)[:user_ids]&.reject(&:blank?)&.any?
@department.reload.user_ids = permitted_attributes(@department)[:user_ids].reject(&:blank?).map(&:to_i)
@department.save!
end
redirect_to @department, make_notice
else
render :new
......
......@@ -161,6 +161,7 @@ class SemesterFeedbackTest < ApplicationSystemTestCase
assert_text goals
click_button 'Schliessen'
wait_for_ajax
assert_text 'Semester Prozess'
page.find('td', text: achievements.truncate(300), visible: false).click
wait_for_ajax
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment