Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: plan validation error when no teams selected #290

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading