Skip to content

Commit

Permalink
fix(web): tighten weight sum validation threshold in CreateTestSection
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrnt committed Feb 28, 2025
1 parent 7bdd0c2 commit d0e308e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/components/Test/CreateTestSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function CreateTestSection({
const weightSum = Number(
variants.reduce((sum, { weight }) => sum + weight, 0).toFixed(2)
);
const isValidWeightSum = Math.abs(weightSum - 100) <= 0.3;
const isValidWeightSum = Math.abs(weightSum - 100) <= 0.1;

useEffect(() => {
const timer = setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Test/Weights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const Weights = ({ options }: { options: ClientOption[] }) => {
const weightsSum = Number(
weights.reduce((sum, curr) => sum + curr, 0).toFixed(2)
);
const isValidWeightSum = Math.abs(weightsSum - 100) <= 0.3;
const isValidWeightSum = Math.abs(weightsSum - 100) <= 0.1;

// Add debounced error display
useEffect(() => {
Expand Down

0 comments on commit d0e308e

Please sign in to comment.