diff --git a/backend/src/modules/boards/services/create.board.service.ts b/backend/src/modules/boards/services/create.board.service.ts index b9950701b..68a167fb9 100644 --- a/backend/src/modules/boards/services/create.board.service.ts +++ b/backend/src/modules/boards/services/create.board.service.ts @@ -272,7 +272,7 @@ export default class CreateBoardService implements CreateBoardServiceInterface { const teamLength = teamUsersWotStakeholders.length; const rawMaxTeams = teamLength / Number(configs.maxUsersPerTeam); - const maxTeams = Math.ceil(rawMaxTeams); + const maxTeams = Math.round(rawMaxTeams); if (maxTeams < 2 || configs.maxUsersPerTeam < 2) { return null; @@ -295,7 +295,7 @@ export default class CreateBoardService implements CreateBoardServiceInterface { hideCards: true, postAnonymously: configs.postAnonymously, hideVotes: configs.hideVotes ?? false, - maxUsers: Math.ceil(configs.maxUsersPerTeam), + maxUsers: configs.maxUsersPerTeam, slackEnable: configs.slackEnable, responsibles }; diff --git a/frontend/src/components/CreateBoard/SplitBoard/SubTeamsTab/QuickEditSubTeams/QuickEditSubTeams.tsx b/frontend/src/components/CreateBoard/SplitBoard/SubTeamsTab/QuickEditSubTeams/QuickEditSubTeams.tsx index f055e7a2a..23c857b3b 100644 --- a/frontend/src/components/CreateBoard/SplitBoard/SubTeamsTab/QuickEditSubTeams/QuickEditSubTeams.tsx +++ b/frontend/src/components/CreateBoard/SplitBoard/SubTeamsTab/QuickEditSubTeams/QuickEditSubTeams.tsx @@ -53,7 +53,7 @@ const QuickEditSubTeams = ({ team }: QuickEditSubTeamsProps) => { const error = hasError(value, minTeams, maxTeams); setIsSubmitDisabled(error); - if (!error) setValue('maxUsers', Math.ceil(teamLength / +value)); + if (!error) setValue('maxUsers', Math.round(teamLength / +value)); setErrors((prev) => ({ ...prev, @@ -87,7 +87,7 @@ const QuickEditSubTeams = ({ team }: QuickEditSubTeamsProps) => { count: { ...prev.count, teamsCount: Math.floor(getValues('maxTeams')), - maxUsersCount: Math.floor(getValues('maxUsers')), + maxUsersCount: Number((teamLength / Math.floor(getValues('maxTeams'))).toFixed(2)), }, board: { ...prev.board, @@ -98,7 +98,8 @@ const QuickEditSubTeams = ({ team }: QuickEditSubTeamsProps) => { useEffect(() => { setValue('maxTeams', teamsCount); - setValue('maxUsers', maxUsersCount); + setValue('maxUsers', Math.round(maxUsersCount)); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [teamsCount, maxUsersCount]); useEffect(() => { diff --git a/frontend/src/hooks/useCreateBoard.tsx b/frontend/src/hooks/useCreateBoard.tsx index e3d7ed15c..6760b1d60 100644 --- a/frontend/src/hooks/useCreateBoard.tsx +++ b/frontend/src/hooks/useCreateBoard.tsx @@ -211,7 +211,7 @@ const useCreateBoard = (team?: Team) => { const handleAddTeam = () => { if (!canAdd) return; - const countUsers = (teamMembersLength / (dividedBoardsCount + 1)).toFixed(0); + const countUsers = (teamMembersLength / (dividedBoardsCount + 1)).toFixed(2); setCreateBoardData((prev) => ({ ...prev, @@ -229,7 +229,7 @@ const useCreateBoard = (team?: Team) => { const handleRemoveTeam = () => { if (!canReduce) return; - const countUsers = (teamMembersLength / (dividedBoardsCount - 1)).toFixed(0); + const countUsers = (teamMembersLength / (dividedBoardsCount - 1)).toFixed(2); setCreateBoardData((prev) => ({ ...prev, diff --git a/frontend/src/pages/boards/newSplitBoard.tsx b/frontend/src/pages/boards/newSplitBoard.tsx index 424153020..4ca3a1b7a 100644 --- a/frontend/src/pages/boards/newSplitBoard.tsx +++ b/frontend/src/pages/boards/newSplitBoard.tsx @@ -176,7 +176,7 @@ const NewSplitBoard: NextPage = () => { title, dividedBoards: newDividedBoards, maxVotes, - maxUsers, + maxUsers: boardState.count.maxUsersCount, team, responsibles, slackEnable,