Skip to content

Commit

Permalink
fix: plan validation error when no teams selected (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
Himali-Malvawala authored Aug 9, 2024
1 parent 56ed3bf commit 90ac07f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plans/components/PlanValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const PlanValidation = (props:Props) => {

const times:TimeInterface[] = [];
positions.forEach(p => {
const posTimes = props.times.filter(t => t.teams.indexOf(p.categoryName)>-1);
const posTimes = props.times.filter(t => t?.teams?.indexOf(p.categoryName)>-1);
if (person.id==="bTrK6d0kvF6") console.log("TIMES", posTimes, p, props.times);
times.push(...posTimes);
});
Expand Down Expand Up @@ -59,7 +59,7 @@ export const PlanValidation = (props:Props) => {
const assignments = props.assignments.filter(a => a.positionId === p.id);
if (assignments.length < p.count) {
const needed = p.count - assignments.length;
issues.push(<><b>{p.name}:</b> {needed} {Locale.label("plans.planValidation.more")} {(needed===1) ? Locale.label("common.person") : Locale.label("plans.planValidation.ppl")} {Locale.label("plans.planValidation.needed")}</>);
issues.push(<><b>{p.name}:</b> {needed} {Locale.label("plans.planValidation.more")} {(needed===1) ? Locale.label("plans.planValidation.person") : Locale.label("plans.planValidation.ppl")} {Locale.label("plans.planValidation.needed")}</>);
}
});
}
Expand All @@ -70,7 +70,7 @@ export const PlanValidation = (props:Props) => {
assignments.forEach(a => {
const position = props.positions.find(p => p.id === a.positionId);
if (position) {
const posTimes = props.times.filter(t => t.teams.indexOf(position.categoryName)>-1);
const posTimes = props.times.filter(t => t?.teams?.indexOf(position.categoryName)>-1);
duties.push({position, times:posTimes});
}
});
Expand Down

0 comments on commit 90ac07f

Please sign in to comment.